开发者

Issue on setOnclickListener

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 call setContentView(R.layout.abc.xml).
  • Add the Activity to the AndroidManifest file.
  • In the OnClickListener of the button, write:

    startActivity(new Intent(YouActivityWithTheButtons.this, Abc.class));

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜