I have two buttons set, "OK" and "Cancel" in main.xml. I have setOnclickListener
for the Cancel. When I click on OK i need another xml file say abc.xml to get displayed. I have added that x开发者_如何学Goml file under the layout folder.
How do I do this?
I guess your abc.xml is another Activity
. What you need to do is:
- Create a class that extends
Activity
, for example Abc. - In the
onCreate()
method callsetContentView(R.layout.abc.xml)
. - Add the
Activity
to theAndroidManifest
file. In the
OnClickListener
of the button, write:startActivity(new Intent(YouActivityWithTheButtons.this, Abc.class));
精彩评论