I'm trying to integrate search in my app but I'm being blocked by one issue. My activity is declared like this and is located inside of TabActivity.
<activity
android:name="FileBrowserActivity"
android:screenOrientation="portrait"
android:launchMode="singleInstance">
<开发者_运维知识库intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
As you can see its launchMode is set to singleTop. But when I invoke search, input the search query and press enter another instance of such activity is launched. No onNewIntent is being called! But in the launched activity each new search doesn't launch a new activity.
The desired behaviour is to stay within current activity. Basically that's how android launcher search works.
You should rather use android:launchMode="singleTop"
like described in this article.
You could use android:noHistory http://developer.android.com/guide/topics/manifest/activity-element.html#nohist
精彩评论