java - how to reload main activity after click "OK" on AlertDialog -
I have an alert dialog and I have to reload the main activity after clicking "OK". The problem is that after my activity has returned to the home screen, click OK
Java Code:. Help will be appreciated. Change the code the
private void buildAlertMessageNoGps () {final AlertDialog.Builder builder = new AlertDialog.Builder (this); builder.setMessage ( "This application needs GPS satellites or wireless networks enable localization" + "\ n" + "Do you want to enable it?") .setCancelable (right) .setPositiveButton ( "Yes", the new DialogInterface.OnClickListener () {public void onClick (last DialogInterface dialog, @SuppressWarnings ( "unused") final int id) {StartActivity (new intent (Settings.ACTION_LOCATION_SOURCE_SETTINGS)); end (); startActivity (getIntent ());}}) .setNegativeButton ("No", New DialogInterface.OnClickListener () {Public Zero onClick (Last DialogInterface Dialog, @SuppressWarnings ("Unused") Last Flood Nank id) {dialog.cancel ();}}); Final Alert Dealog Warning = Builder.Create (); Alert.show ();
new DialogInterface.OnClickListener () {public void onClick (last DialogInterface dialog, @SuppressWarnings ( "unused") final int id) {startActivity (new intent (Settings.ACTION_LOCATION_SOURCE_SETTINGS)); End(); StartActivity (getIntent ()); }
new DialogInterface.OnClickListener () {public void onClick (Last DialogInterface dialog, @SuppressWarnings ( "unused") final int id) { StartActivityForResult (new intent (settings. ACTION_LOCATION_SOURCE_SETTINGS), 0); }
Comments
Post a Comment