> I am using ListActivities to drill down into a hierarchy; artist,
> album and song. One activity per hierarchy. So, from the main
> activity  I start the ArtistActivity with the StartActivityForResult
> method and when the an artist is selected I call the
>
> protected void onListItemClick(ListView l, View v, int position, long
> id) {
>
> setResult(Activity.RESULT_OK, results);
> finish();
>
> }
>
> to return the results. Than the main activity receives results from
> the ArtistsActivity in the onActivityResult method and starts the next
> hierarchy’s activity, AlbumActivity, in the same way as the previous
> activity, on so on. It works fine except that when calling finish
> method the hierarchy activity is removed from the stack. So, it makes
> it impossible to backtrack to the previous hierarchy since it’s not
> there anymore. For example, I can’t backtrack from AlbumActivity to
> the ArtistsActivity since it has been removed from the stack.  My
> question is; is there any way to leave the hierarchy activities on the
> stack?

Instead of calling setResult()/finish() in a list item click,
startActivityForResult() the next level down in the hierarchy. Only the
leaf should call setResult()/finish() in a list item click. All branches
of the hierarchy should call setResult()/finish() in their
onActivityResult(), forwarding the leaf's result Intent along.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html


-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to