i want to use set content view on android studio to show a welcome message on screen before show the real main activity.
I just copy the part of code that i think it responsible for the crash of my app because if i remove the part of welcome activity ,i will get no error.
Remember android studio dose not show error just when you run it, program will crash. is there a way to make it not crash?
(any suggestion for make it better for bigger change of layouts because i will going to add more layout later with their activitys )
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_welcom);
Button btn = (Button) findViewById(R.id.button);
View.OnClickListener welcomeListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
setContentView(R.layout.activity_main);
}
};
btn.setOnClickListener(welcomeListener);
}