여러 활동이있는 Android 앱
-
19-09-2019 - |
문제
하나의 활동으로 구성된 매우 간단한 게임이 있으며 제목 화면을 추가하고 싶습니다.
제목 화면이 다른 활동 인 경우, 제목 화면을 먼저 열기 위해 매니페스트 파일을 변경 해야하는 변경이 필요합니까?
게임 플레이 활동을 Leeder라고하며 제목 화면 활동을 Leedertitlescreen이라고합니다.
다음은 내 현재 매니페스트 파일입니다.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.nifong.leeder"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name="Leeder"
android:label="@string/app_name"
android:configChanges="keyboardHidden|orientation"
android:screenOrientation="landscape">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
<uses-sdk android:minSdkVersion="5" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
</manifest>
해결책
당신이해야 할 일은 변화뿐입니다.
<activity android:name="Leeder"
에게:
<activity android:name="LeederTitleScreen"
타이틀 화면이 게임을 시작하려면 startActivity()
, 당신은 또한 당신의 선언이 필요합니다 Leeder
매니페스트의 활동.
편집하다: 네, 당신은 필요합니다u003Cintent-filter> 부분. 그것은 당신의 활동이 응답 할 의도를 암시하는 시스템에 알려줍니다. 그래서 당신의 명시에서, 의도 필터는 시스템에 응답 할 것이라고 알려줍니다. android.intent.category.LAUNCHER
의도, 이것은 앱을 시작할 때 Android가 발송하는 것입니다 (즉, 애플리케이션이 시작될 때 Android에게 활동을 시작하도록 지시합니다).
여기 의도 및 의도 필터에 대한 좋은 개요입니다.
제휴하지 않습니다 StackOverflow