我想在android手机中的模式锁之前显示启动画面活动。例如,如果您正在使用任何应用程序,则可以在锁定模式之前看到启动画面。
答案 0 :(得分:0)
尝试以下代码,
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();
}
}
}
就是这样