android - Returning to home screen from Activity instead of parent -


i have music player activity doesn't behave want. activity can opened inside app, notifications bar , when switching/resuming app background.

when launched app -> backpress on activity -> returns previous app activity. ok

when launched notification -> backpress on activity -> returns home screen (it ok)

when resumed homescreen/recent apps -> backpress on activity -> returns home screen (not ok) - user assume app since activity leaf , tab activity root activity.

i want parent activity when pressing back, not going on home screen(when resumed notifications, ok if returns home screen, both variants ok me in scenario)

<activity android:name=".player.playeractivity"                     android:configchanges="keyboardhidden|orientation"                     android:label="@string/audio_player_activity_title"                     android:launchmode="singleinstance"/> 

and starting activity:

//this intent started fragment (sherlockfragment) intent = new intent(getactivity(), playeractivity.class); startactivity(i); 

note: want single instance avoid 2 activities of same type running on screen (happen when using notifications)

could me this?

when use launchmode: "singleinstance", activity launched in new task: [http://developer.android.com/guide/topics/manifest/activity-element.html][1] that's why dont see normal behavior of stack. sure android instanciates once activity can set flag : flag_activity_reorder_to_front when launch activity

intent.setflags(intent.flag_activity_reorder_to_front); 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -