Code example for AlertDialog.Builder

Methods: create, setCancelable, setMessage, setPositiveButton, setTitle

		// 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.setPositiveButton("OK", new DialogInterface.OnClickListener() {
				public void onClick(DialogInterface dialog, int which) {
					// clicking OK just closes modal dialog. 
			// create and show dialog 
			AlertDialog ad = b.create();;
Contextual code suggestions in your IDE  Get Codota for Java