How can I open another layout xml file when I click on a button in main.xml file?
so if I have main.xml which has a button sying click here and I click it, it opens
-Inflate the button from the xml
-add an onClickListener on it
-set a new layout in the onClick event
Button btn = (Button) findViewById(R.id.myButton);
btn.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v)
{
MyActivity.setContentView(R.layout.newlayout);
}
});
Something like this should work...