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 the activity internal call, you need to use the getactivity () method return value activity call. If implemented a prompt box (alertdialog), containing two buttons, return and set , one is the Jump Location service settings interface, one is to return to the previous level interface.

    Dialogfragment Mlocationdialog = new Alertdialogfragment (). Settitle ("Start location Service")            . Setmessage ("In order 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 to set GPS                            Locationserviceutils.gotolocservicesettings (Getappcontext ());                            return;                        Default:                            return;}}            );




Android-Back 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.