0

I face a bug in the start of my app when the splash screen is open. There is 1 to 2 seconds delay occur before launched the splash screen. Here i provide the link of video please check how it behave:

Preview of launching splash screen

Here is the AndroidManiseft code to launched splash screen:

  <activity
        android:name=".activities.SplashActivity"
        android:theme="@style/customStyleForSplash">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

And here is the code of "SplashActivity":

public class SplashActivity extends AppCompatActivity {

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

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            if(MySharedPref.getInstance(SplashActivity.this).isUserSetLocation()){
                startActivity(new Intent(SplashActivity.this, ContainerActivity.class));
                finish();
            } else {
                startActivity(new Intent(SplashActivity.this, LocationOptionsActivity.class));
                finish();
            }
        }
    }, 2000);

}

}

Please suggest me the possible solutions. Thanks

Addy
  • 75
  • 2
  • 10

0 Answers0