简体   繁体   中英

How to call main Xml from Second Xml in android on button click?

I have two xml file. From first main Xml I am calling Second Xml file.

Second Xml file has some control and 'Ok' and 'Cancel' Button.

My question is how go first main when I click on 'Ok' or 'Cancel' Button?

How should I write the code on 'Ok' or 'Cancel' Button OnClickListener?

Thanks In Advance!

My friend first of all i want to make you clear that you can go from one activity to the other ,or you can set an xml layout on the current activity.However saying that you *

go from one xml to the other is wrong.

*

  • Now if you want to go back to the old activity just use the intent in the similar way you used to go from first to the second activity on your button click

  • and if you want to set the old layout then call setContentView() in the OnClickListener() and pass the layout's id in setContentView() on your button click

Thanks..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM