Android app with multiple activities

前端 未结 1 925
星月不相逢
星月不相逢 2021-02-06 02:26

I have a very simple game that consists of only one activity, and I want to add a title screen.

If the title screen is another activity, what changes do I need to make t

相关标签:
1条回答
  • 2021-02-06 02:56

    All you should have to do is change:

    <activity android:name="Leeder"
    

    to:

    <activity android:name="LeederTitleScreen"
    

    If you want your title screen to start the game via startActivity(), you'll also need to declare your Leeder activity in the manifest.

    Edit: Yes, you need the <intent-filter> section. It tells the system which implicit intents your activity will respond to. So in your manifest, the intent filter tells the system that it will respond to the android.intent.category.LAUNCHER intent, which is what Android dispatches when it starts an app (i.e. it tells Android to start the Activity when the application is started).

    Here is a good overview of intents and intent filters.

    0 讨论(0)
提交回复
热议问题