Abh*_*nav 3 android timer android-activity
我有一个闪屏.我只是希望它等待1或2秒,然后继续进行下一个活动.我知道有很多方法,包括处理程序类和java.util.timer实现.但这是最简单,最轻松的方法.Thanx提前.
Dip*_*iya 14
使用以下代码.
Splash_Screen_Activity.java
public class Splash_Screen_Activity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
final Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
// TODO: Your application init goes here.
Intent mInHome = new Intent(Splash_Screen_Activity.this, InvoiceASAPTabActivity.class);
Splash_Screen_Activity.this.startActivity(mInHome);
Splash_Screen_Activity.this.finish();
}
}, 3000);
}
}
Run Code Online (Sandbox Code Playgroud)