1

I need a hand with the Android Manifest file. I have 4 java files called: MainActivity, Splash, TextPlay and Menu. I want the Splash file to be displayed first. (I have it set for 5 seconds) I then want the Menu to be displayed(I have the rest of the files displayed on Menu page.)

The app also wont debug on the emulator and im guessing its the manifests fault. Can someone help me achieve this, Thanks!!

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.intigerdev.numberapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="10"
    android:targetSdkVersion="18" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >

    <activity
        android:name=".Menu"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAINACTIVITY" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.intigerdev.numberapp.MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MENU" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".TextPlay"
        android:label="@string/app_name" >
    </activity>
</application>


</manifest>

1 Answers1

0

You will have to move between activities on your own. The manifest doesn't do that for you.. if you want your app to start on the Splash screen use this manifest instead:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.intigerdev.numberapp"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="10"
    android:targetSdkVersion="18" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".Splash"
        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=".Menu"
        android:label="@string/app_name"/>
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"/>
    <activity
        android:name=".TextPlay"
        android:label="@string/app_name"/>
</application>
</manifest>

OnCreate of the Splash activity (stackoverflow.com/a/6489385/736496):

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.splash);

    Handler handler = new Handler();
    handler.postDelayed(new Runnable() {
        public void run() {
            finish();
            Intent intent = new Intent(Splash.this, Menu.class);
            startActivity(intent);
        }
    }, 5000);
}
Community
  • 1
  • 1
JustinMorris
  • 7,259
  • 3
  • 30
  • 36
  • Thanks for that, The emulator is running it now but the splash screen isnt closing after 5 seconds. Is this right: protected void onCreate(Bundle BundleName) { // TODO Auto-generated method stub super.onCreate(BundleName); setContentView(R.layout.splash); Thread timer = new Thread(){ public void run(){ try{ sleep(5000); } catch (InterruptedException e){ e.printStackTrace(); }finally{ Intent openMainActivity = new Intent("com.intigerdev.numberapp.MENU"); startActivity(openMainActivity); } } }; timer.start(); } } – user3329680 Mar 09 '14 at 19:58
  • did that fix your problem? – JustinMorris Mar 11 '14 at 02:41
  • I got it working thanks, now i must just figure out how to make menu items clickable! – user3329680 Mar 11 '14 at 19:14