public class MainActivity extends Activity{ private Button btn; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); btn=(Button)findViewById(R.id.button1); btn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub setContentView(R.layout.secondlayout); } }); }
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
setContentView(R.layout.secondlayout);
}
});
}