try following code,
public class Splash extends Activity {
private static final int SPLASH_SHOW_TIME = 1000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_splash);
new BackgroundSplashTask().execute();
}
private class BackgroundSplashTask extends AsyncTask<Void, Void, Void> {
@Override
protected void onPreExecute() {
super.onPreExecute();
}
@Override
protected Void doInBackground(Void... arg0) {
try {
Thread.sleep(SPLASH_SHOW_TIME);
} catch (InterruptedException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
Intent i = new Intent(Splash.this, LockPatern.class);
startActivity(i);
finish();
}
}
}
That's it
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…