search
LoginSignup
35
Help us understand the problem. What are the problem?

More than 5 years have passed since last update.

posted at

起動時のActivityを変更する

AndroidManifest.xmlの編集

inter-filterタグが記述されたActivityタグ内のandroid:nameを起動時に表示したいActivity名に変更する。

<intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

たとえば、MainActivityからSubActivityへ変更した場合は下記のとおり。

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.exapmle.test" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".subActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name=".MainActivity" >
        </activity>
    </application>
</manifest>

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
35
Help us understand the problem. What are the problem?