package com.harizontrip;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
//step 1:
Thread th=new Thread(){
// step 2:
@Override
public void run() {
// TODO Auto-generated method stub
super.run();
try {
sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// step 4:
finally{
startActivity(new Intent(MainActivity.this,second.class));
}
}
};
// step 3:
th.start();
}}
output will be th following:
No comments:
Post a Comment