I have a MainActivity.java
file with a single layout. I created a new layout that is simply called layout2, and want to call it somehow in the MainActivity.java file, to switch between the 2 layouts with a btn click, but without any .java class file (like in Activities: .java file goes with his own single layout).
For short:
An Activity open (just) a new layout file.
Thanks for any answers.
ImageButton ibtt;
ImageButton ib = (ImageButton)findViewById(R.id.ibtt);
ib.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
MainActivity.setContentView(R.layout.secondlayout);
}
});