0

In some Emulators, if the user presses the home key in the launcher, it does a different task than if you switch to it from another app:

For example, if the user presses home, it launches home. But if the user presses home again in the launcher, it opens the app drawer.

I am wondering how this can be done? I tried to emulate the home launch intent by setting intent action as ACTION_MAIN and category as CATEGORY_HOME to no avail.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
kevdliu
  • 1,709
  • 4
  • 29
  • 46

1 Answers1

0

The short answer is that when an Activity is already in memory, then the new call to startActivity() will result in Activity.onNewIntent() being called, rather than the usual onCreate() method.

  • 1 click goes to onCreate()
  • 2 clicks go to onNewIntent()

So you can implement this behaviour by overriding the onNewIntent() method.


For the long answer, rather look at a full description of the problem at this link:

I can not say it better than this.

Community
  • 1
  • 1
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255