Search code examples
javaandroidandroid-intentsplash-screen

problems with my Android Manifest splashscreen activity


I am developing an android app which is working perfectly fine,If i change the switch the .LAUNCHER WITH .DEFAULT, The program is crashing and no error messages is showing in the log. This is what i try after following some instruction online.

1.Download A new gradle 2.Clean my Project 3.Sync my gradle All this things didnt work for me,pls need help. package com.asimyaz.android.nilemssn;

    import android.content.Intent;
    import android.os.Handler;
    import android.support.v7.app.ActionBarActivity;
    import android.os.Bundle;
    import android.view.Menu;
    import android.view.MenuItem;


    public class Splash extends ActionBarActivity {

        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_splash);

            Handler handler = new Handler();

            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    Intent i =new Intent(Splash.this,MainActivity.class);
                    startActivity(i);
                    finish();
                }
            },10000);
        }


        @Override
        public boolean onCreateOptionsMenu(Menu menu) {
            // Inflate the menu; this adds items to the action bar if it is present.
            getMenuInflater().inflate(R.menu.menu_splash, menu);
            return true;
        }

        @Override
        public boolean onOptionsItemSelected(MenuItem item) {
            // Handle action bar item clicks here. The action bar will
            // automatically handle clicks on the Home/Up button, so long
            // as you specify a parent activity in AndroidManifest.xml.
            int id = item.getItemId();

            //noinspection SimplifiableIfStatement
            if (id == R.id.action_settings) {
                return true;
            }

            return super.onOptionsItemSelected(item);
        }
    }
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.asimyaz.android.nilemssn" >

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.SEND_SMS" />

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

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
        <activity
            android:name=".bio"
            android:label="@string/title_activity_bio" >
        </activity>
        <activity
            android:name=".past_questions"
            android:label="@string/title_activity_past_questions" >
        </activity>
        <activity
            android:name=".my_web"
            android:label="@string/title_activity_my_web" >
        </activity>
        <activity
            android:name=".my_pdfRend"
            android:label="@string/title_activity_pdf__renderer" >
        </activity>
        <activity
            android:name=".Suggestion"
            android:label="@string/title_activity_suggestion" >
        </activity>
        <activity
            android:name=".Splash"
            android:label="@string/title_activity_splash">
            <intent-filter>
              <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
    </application>

</manifest>

Solution

  • Yippee! I find out the problem,the problem has to do with the size of image i set as the background image for my splashscreen,The image size is too large that it use to crash my app.Just change the image or reduce the pixels. I am sure it will work.