Here you can find the source of buildAlertMessageNoGps(final Context context)
public static void buildAlertMessageNoGps(final Context context)
//package com.java2s; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; public class Main { public static void buildAlertMessageNoGps(final Context context) { final AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage(/*from www . j a v a2 s. c o m*/ "Your GPS seems to be disabled, do you want to enable it?") .setCancelable(false) .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick( final DialogInterface dialog, final int id) { context.startActivity(new Intent( android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS)); } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick( final DialogInterface dialog, final int id) { dialog.cancel(); } }); final AlertDialog alert = builder.create(); alert.show(); } }