OK I’ve had this problem for a while now. I’m developing a camera app that does some verification and uploads a photo to a website.
My problem is, I keep running into the question of making a chain of activities each returning a result on finishing to the previous activity, or making each activity return to the main activity, which spawns the next activity, depending on the result.
Here’s an example: The main activity shows a photo gallery from which you can launch a camera preview. After capturing a photo, another activity opens where you can verify that you want to save that photo. After verifying, you are shown another activity which displays the progress of your upload. This could be implemented as a chain of startactivityforresults:
Gallery -> camera -> Verification -> Upload -> verification -> camera -> Gallery
OR as:
Gallery -> camera
camera -> Gallery
Gallery -> Verification
Verification -> Gallery
Gallery -> Upload
Upload -> Gallery
Don’t use an activity to show the upload progress. Use a ProgressDialog, or, better yet, offload the operation to an IntentService in the background. Remember to check for network connectivity before you attempt an upload!
As an alternative to “verifying” a save, you could do the save automatically and then allow the user to “undo” it. The UX guidelines suggest that the fewer interactions, the better, especially on small devices.
You could also save all the photos from a “session” to local storage, then allow the user to upload them later on, or asynchronously.
Besides that, you probably want separate activities/fragments if you want to allow the user to move back and forth at will between the steps, and have each step preserve its state.
In short, you should first spend some time thinking about what users do. Once you have some hazy model of how a user wants to use your app, then design it to achieve that. Too many developers rush off to build an app according to their understanding of the API. That approach is limiting.