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