How to activate startup as a home activity

I have 3 actions in my application. A - is an action run when I click "Activity B", then I have a button to launch the Activity A, or I can click the "Back" button, and I can go to the previous values, press A. On the rear panel, held in with the button pressed and press the new values ​​to be set to A.

When I click in the B, A start, I use a flag REORDER TO FRONT and singleletop as the start mode. The new activity is created. When I press the "Back" button on "A", it will go into "B" mode and press the "OK" button again. I want to Activity A has been pressed on the B. I can not do anything in onBackpressed() in B, because B is used in several scenarios, in addition to the above scenario. How to manage it.

+4
source share
1 answer

I also do not understand what you're trying to do, but you can try to navigate the template ( http://developer.android.com/design/patterns/navigation.html#up-vs-back ).

You need to declare in his manifesto that action A is the parent of the action B, and then use NavUtils.navigateUpFromSameTask(this); in your OnClickListener button. (NavUtils stored in the package support.v4).

+1
source

Source: https://habr.com/ru/post/1491772/


All Articles