I want to execute a piece of code
So that users can pay attention to my LOGO
Like other APP
I want to use timer Execution setContentView.
Compiler is not wrong.
But execution error.
unfortunately has stopped.
Timer timer;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
abc();
}
public void abc() {
timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
goToLayout1();
}
private void goToLayout1() {
setContentView(R.layout.activity_main2);
timer.cancel();
}
}, 1000, 2000);
}
}
I suggest you should have two activity.First activity is for showing splash screen.You can finish this after 3 seconds and start another activity that is activity with the layout actitiy_main2.