0

In my application, I have specified a second activity that can be launched from the launcher, using this manifest entry:

    <activity 
        android:name=".Lists.ListOfListsActivity"
        android:icon="@drawable/ic_launcher_lists" 
        android:launchMode="singleTop"
        android:label="@string/lists_activity_name" >
        <!--  An Intent filter so that the Lists activity shows in the Launcher -->
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Let's say I have the app open at the "main" activity then press the home key. My app will still be running, but in background.

Later the user selects the launcher icon I have for "ListsOfListsActivity" from the homescreen.

This will bring the application to the foreground, but NOT at the "ListOfListsActivity", but at whatever it's current activity was when it went to the background (e.g. at the "main"activity).

This is confusing, as the user selected the "ListOfListsActivity" but is shown another one. Then they have to navigate to it.

I had this working better, by specifying launchMode = "singleTask" for the "ListOfListsActivity", but in that mode it cannot be launched from another activity for a result (startActivityForResult() ), and I need to be able to do that to pick a list...

Question: - how to specify an intent-filter that will force an activity to the foreground and be the selected activity, no matter what the current status of the application and it's current activity??

Andrew Mackenzie
  • 5,477
  • 5
  • 48
  • 70

1 Answers1

0

My final implementation was to define a different taskAfinity string for each activity I wanted to launch independently from the Launcher.

That way, each "shortcut" always launches the activity I want, but the downside that I have not been able to avoid is that the user may have multiple tasks with an activity from my application in it, and maybe the same activity open/active in different tasks....

Andrew Mackenzie
  • 5,477
  • 5
  • 48
  • 70