Skip to content Skip to sidebar Skip to footer

How To Show Splash Screen Before The Pattern Lock?

I wanted to show a splash screen activity before the pattern Lock in android Phone. Example if you are using any application, you can see splash screen before the the lock pattern.

Solution 1:

try following code,

publicclassSplashextendsActivity {

    privatestaticfinalintSPLASH_SHOW_TIME=1000;

    @OverrideprotectedvoidonCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
//      
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_splash);

        newBackgroundSplashTask().execute();

    }

    privateclassBackgroundSplashTaskextendsAsyncTask<Void, Void, Void> {

        @OverrideprotectedvoidonPreExecute() {
            super.onPreExecute();
        }

        @Overrideprotected Void doInBackground(Void... arg0) {
            try {
                Thread.sleep(SPLASH_SHOW_TIME);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            returnnull;
        }

        @OverrideprotectedvoidonPostExecute(Void result) {
            super.onPostExecute(result);
            Intenti=newIntent(Splash.this, LockPatern.class);
            startActivity(i);
            finish();
        }

    }
}

That's it

Post a Comment for "How To Show Splash Screen Before The Pattern Lock?"