android - Flag for preferenceactivity -
i'm having problem managing activities in history stack.
background:
i've 2 activities: main , preference.
i've broadcast receiver starts notification @ boot. notification starts main activity. flags are: intent.flag_activity_clear_top|intent.flag_activity_single_top intent , notification notification.flag_auto_cancel. (in tutorial, broadcast receiver started service started notification. i'm starting notification directly on broadcastreceiver. it's working fine me heads up.)
the intent starting preference activity has no flags set.
problem
- start main activity launcher , open preference activity.
- while in preference activity click notification launches main activity again. open preference activity again.
- press home , launch application opens main activity.
- now if click instead of exiting app preference activity(the 1 opened earlier) , moves me main activity(the 1 opened earlier).
in last app had used activitymode="singleinstance" rid of new instance of activities getting created notification. want fix 1 better way, i.e. using correct flags.
override onbackpressed method in main activity explicitly finish() main , preference activities.
Comments
Post a Comment