I have 2 layouts named "main.xml" and "main2.xml"
In main.xml, there's a button "new"
In main2.xml, there's a button "back"
button new:
Button button1 = (Button)findViewById(R.id.newstore);
button1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setContentView(R.layout.main2);
}
});
I change view to main2.xml successfully,
but when I add these code:
button back:
Button back = (Button)findViewById(R.id.back);
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setContentView(R.layout.main);
}
});
I can't run this project anymore!! I have to forcekill it everytime!
What's the problem?
I can upload my project if you need it to answer.