So I have 2 XML layout files.
One is the menu and the other is the app.
So, now I have some buttons on the one XML file and some other buttons on the other file.
So this code works:
setContentView(R.layout.main);
start = (Button) findViewById(R.id.button1);
start.setOnClickListener(this);
But if I change the view and write this:
setContentView(R.layout.random);
add_person = (Button) findViewById(R.id.add);
add_person.setOnClickListener(this); //crash here
The app crashes!