Finishing (or Accessing) a specific Activity in Android -
as activities opened user, they're stacked on view stack. , user finishes activity means, popped out of view stack.
now, have situation user has opened app's home screen, , has successively opened multiple activities, on top of home screen. in each activity, there's control lets user see home screen again.
as can think, there can 2 approaches this:
- on press of control, pop home screen bottom of view stack , push on top of it.
- as control pressed, start popping each of current screen until home screen becomes current screen.
i know there's way in android @ least 1 of this, or this. can't remember it.
please me choose better approach, , let me know way (the code, specifically) it.
thanks lot :)
(please edit title/text if isn't appropriate)
try this
intent = new intent(); i.putextra(extra_key_artist, id); i.setclass(this, artistactivity.class); i.addflags(intent.flag_activity_single_top); startactivity(i);
that's when set the flag_activity_single_top property wont start new activity show activity intially created if not destroyed yet,
but if activity starting activity can put this
<activity android:name=".artistactivity" android:label="artist" android:launchmode="singletop"> </activity>
Comments
Post a Comment