java - How to open activity from widget like this: if app is not open, open main activity too but if app is open, just open on top of the current activity? -
basically want user able hit , reach main activity @ point. here 2 senarios:
- if app open, widget launch app , start activity on top of it.
- if app not open, want main activity present in stack.
is possible? think senario 2 code right:
intent mainactivityintent = new intent(context, mainactivity.class); mainactivityintent.setflags(intent.flag_activity_new_task | intent.flag_activity_clear_task); //this starts app fresh (i.e. clears current activities) intent addcruisesintent = new intent(context, secondactivity.class); addcruisesintent.setflags(intent.flag_activity_new_task ); //this starts app fresh (i.e. clears current activities) intent[] intents={mainactivityintent,addcruisesintent}; intent[] intents={addcruisesintent}; pendingintent pendingintent = pendingintent.getactivities(context, 0, intents, 0);
i wondering if there flag or combination of flags can achieve want.
Comments
Post a Comment