3

I have a single activity in my app that uses a SearchView to search (see manifest-- the search intent is intercepted). However, when I press search, nothing happens. The activity never re-starts itself. So, I removed android:launchMode="singleTop" from my activity and then it started re-starting itself and "working." However, it is preferable to have singleTop for me so that the activity only has one instance. Why is this not working when I have singleTop?

<activity
        android:name="com.brianco.andypedia.MainActivity"
        android:label="@string/app_name"
        android:launchMode="singleTop" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.SEARCH" />
        </intent-filter>
        <meta-data android:name="android.app.searchable" android:resource="@xml/searchable" />
    </activity>

    <meta-data android:name="android.app.default_searchable"
        android:value=".MainActivity" />
Eric Cochran
  • 8,414
  • 5
  • 50
  • 91
  • I apologize that I can't remember how I solved this, but, if I had to guess, I would say trying overriding onNewIntent() in your Activity. I hope that helps! – Eric Cochran Jul 30 '14 at 21:02

2 Answers2

1

I don't know if this answers your question, but this page shows a simple searchview example with ActionBar Compat (it is the new google library compatible for the old Android versions)

Ciro Mine
  • 819
  • 8
  • 15
0

You need to process your search intent on onNewIntent besides onCreate.

Felipe
  • 41
  • 4