Display the main menu / main screen of the application when returning to the application after starting an external action / intention

I launch Android Market through my application to search for similar products using this code:

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://market.android.com/search?q=pub:\"some txt\""));
c.startActivity(intent);

This is great for displaying similar products. However, if I clicked the home button on the market when I open the application again, it still shows market results. In this case, I want to go to the main menu.

Is there a solution?

+5
source share
3 answers

, FLAG_ACTIVITY_NO_HISTORY, , . - . , , , , ( ). .

, , , ( ).

FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET.

+15

FLAG_ACTIVITY_NO_HISTORY , . , , , .

Intent intent = new Intent(Intent.ACTION_VIEW,
    Uri.parse("http://market.android.com/search?q=pub:\"some txt\"")); 

c.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
c.startActivity(intent); 

: hackbod : FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET , .

+10

.

When you click on a house in the Market application, it does not close, it just pauses. Therefore, when you open it again, you resume it. Check out the Android life cycle .

0
source

All Articles