Best way to exit an activity and return to another

Put your problem here if it does not fit any of the other categories.

Best way to exit an activity and return to another

Postby theblang » Thu May 27, 2010 9:23 pm

What is the best way to exit an activity and return back to a previously started activity? Right now I feel that the way I am attempting to solve the problem is not how it really should be done. In addition, I am receiving a null pointer exception.

Activity A is started.
Activity B is started from within Activity A.
Activity B calls the native camera and does some image processing with the activityresult.
Activity B calls a new instance of Activity A within onDestroy()
Activity A (new instance) starts.
Exception is thrown.

What I ultimately would really like to do is spawn Activity B from Activity A in a new thread so that a picture could be taken, Activity A could regain focus, and the image processing could be done behind the scenes. Any help with this would be greatly appreciated!
theblang
Junior Developer
Junior Developer
 
Posts: 15
Joined: Tue May 18, 2010 9:37 pm

Top

Re: Best way to exit an activity and return to another

Postby anarche » Fri May 28, 2010 6:41 am

Activity.startActivity(intent) or if you want to use the return value (such as the picture file from the camera) use Activity.startActivityForResult(intent, requestCode)

http://developer.android.com/reference/ ... ent.Intent)

then just call finish() to close the app you are using.
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 19 guests