tags:

views:

81

answers:

1

For invoke search android example, every time query search result is received by onCreate(). How can i make it received by onNewIntent(). What kind of operation can cause onNewIntent() receive intent?

A: 

Your activity needs to declare android:launchMode="singleTop" in the manifest for onNewIntent() to be called. If a new intent is received and an instance of the activity does not exist on the activity stack onCreate() will be called. If it does exist in the activity stack, onNewIntent() will be called instead.

The docs for android:launchMode go into a bit more detail.

Erich Douglass