android - baseActivity starts Activity/Dialog from Navbar. What Activity is under the dialog -
i hesitated ask question don't have code blocks show. problem more conceptual.
i have baseactivity handles actionbar. baseactivity inherited across activities actionbar accessible everywhere. app shopping app , 1 of buttons on actionbar set "view shopping cart" activity in dialog theme looks popup on whatever activity running when user pressed button.
within cart, want have buttons give user quick access add new items in catalog. press button, start catalog , let user shop. works fine.
the problem if catalog current activity when dialog invoked, i'd dismiss dialog , go catalog - otherwise, have 1 instance of catalog running , pressing button causes instance.
is possible determine activity active when dialog invoked actionbar?
you might find intent flags can handle behavior looking for. example, when build intent launch catalog add: flag_activity_reorder_to_front - not create new activity if in task stack , job of bringing existing activity top user left off if user navigated away it, expected "return" cart.
here's link explain intent flags: how use intent.flag_activity_clear_top clear activity stack?
Comments
Post a Comment