Advertisement
Guest User

networkDialog

a guest
Oct 18th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1.  public void showSettingsNetworkAlert(){
  2.         AlertDialog.Builder alertDialog = new AlertDialog.Builder(mContext);
  3.  
  4.         alertDialog.setTitle("Network is settings");
  5.  
  6.         alertDialog.setMessage("Network is not enabled. Do you want to go to settings menu?");
  7.  
  8.         alertDialog.setPositiveButton("Settings", new DialogInterface.OnClickListener() {
  9.             public void onClick(DialogInterface dialog,int which) {
  10.                 Intent intent = new Intent(Settings.ACTION_SETTINGS);
  11.                 mContext.startActivity(intent);
  12.             }
  13.         });
  14.  
  15.         alertDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  16.             public void onClick(DialogInterface dialog, int which) {
  17.                 dialog.cancel();
  18.             }
  19.         });
  20.  
  21.         alertDialog.show();
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement