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