Android makes a return button implementation on the Interface

Source: Internet
Author: User

The first method is relatively simple and common ~ Because I have developed such things:
CodeAs follows;

Public class actjava extends activity {
Public void oncreate (bundle savedinstancestate ){

Super oncreate (savedinstancestate );
Setcontentview (R. layout. Main );
Button button = (button) This. findviewbyid (R. layout. button1 );
Button, setonclicklistener (New onclicklistener {
@ Override
Public void onclick (view v ){
Setcontentview (R. layout. **) // *** the interface name you want to go
}
}
);
}
}

The second method code is different from the first one. · As long as you understand it, you just need to call one more class to implement it. · depending on the situation. · the second method is also required. mastered
Public class actjava extends activity {
Public void oncreate (bundle savedinstancestate ){

super oncreate (savedinstancestate);
setcontentview (R. layout. main);
button = (button) This. findviewbyid (R. layout. button1);
button, setonclicklistener (New onclicklistener {
@ override
Public void onclick (view v) {
intent inten = new intent (actjava. this ,****. class) // **** the interface name you want to go to
startactivity (intent);
}< BR >}< br> );
}< BR >}< br> you also need to register the class to androidmanifest. in XML. Otherwise, you will find that the implementation cannot be run.
after the original activity ends, add a line.

Android: Name = ". * ******* "

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.