How do I get multiple icons to launch different activities in one application?

前端 未结 2 614
青春惊慌失措
青春惊慌失措 2020-11-27 03:09

I have an application with two activities and I\'d like to be able to have two icons appear in the launcher, each launching the respective activity within the app.

2条回答
  •  抹茶落季
    2020-11-27 03:43

    What you need to do is have your settings activity launch in another task. You can do this by specifying its task affinity. This is done with the attribute android:taskAffinity. By default all activities share the same task affinity that defaults to main package specified in the manifest. On your settings activity you can specify android:taskAffinity="your.own.package.SettingsTask" to have the settings activity launch in its own task.

    Extra documentation.

提交回复
热议问题