Android-Back to previous interface finish () method

Source: Internet
Author: User

return to the previous interface finish () method


This address: Http://blog.csdn.net/caroline_wendy


Android can use the finish () method to implement functions returned by the function . When not an activity is called internally. You need to use the return value of the getactivity () method for activity invocation. If a prompt box is implemented (Alertdialog), including two button, return and set. One is the Jump Location service settings interface, one is to return to the upper level interface.

    Dialogfragment Mlocationdialog = new Alertdialogfragment (). Settitle ("Start location Service")            . Setmessage ("For you to better use this feature. Please turn on location services, otherwise you will not be able to use this feature.

") . SetButtons (" Back "," set ") . Setonbuttonclicklistener (New Dialoginterface.onclicklistener () { @ Override public void OnClick (Dialoginterface dialoginterface, int. i) { switch (i) {case 0://"Cancel" button to exit directly getactivity (). Finish (); return; Case 1://"Settings" button set GPS locationserviceutils.gotolocservicesettings (Getappcontext ()); return; Default: return;}} );





Android-Return to previous interface finish () method

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.