Code example for AlertDialog.Builder

Methods: create, setCancelable, setMessage, setPositiveButton, setTitle

0
		// ensure the intent is sent with they are entering the location (and 
		// not exiting) 
		if (intent.getBooleanExtra(LocationManager.KEY_PROXIMITY_ENTERING,
				false)) { 
			// use builder to create alert dialog. 
			Builder b = new AlertDialog.Builder(context);
			b.setTitle("You Have Arrived");
			b.setMessage("Your current location is on your pin.");
			b.setCancelable(true);
			b.setPositiveButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					// clicking OK just closes modal dialog. 
					dialog.cancel();
				} 
			}); 
 
			// create and show dialog 
			AlertDialog ad = b.create();
			ad.show();
		} 
	} 
} 
Contextual code suggestions in your IDE  Get Codota for Java