Android AlertDialog Create buildAlertMessageNoGps(final Context context)

Here you can find the source of buildAlertMessageNoGps(final Context context)

Description

build Alert Message No Gps

Declaration

public static void buildAlertMessageNoGps(final Context context) 

Method Source Code

//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();
    }
}

Related

  1. alert(String title, String message, Context context, boolean linksClickable)
  2. confirm(String title, String message, Context context, DialogInterface.OnClickListener onConfirmListener)
  3. confirm(String title, View view, Context context, DialogInterface.OnClickListener onConfirmListener)
  4. confirmBuilder(String title, Context context, DialogInterface.OnClickListener onConfirmListener)
  5. canShowAlertDialog(Context context)
  6. alert(Context ctx, String msg)
  7. showAlert(Context context, String title, String message)
  8. showAlertDialog(Context context, String title, String message)
  9. manageAlertDialog( final Activity fourerrActivity, final String dialogTitle, final String dialogMessage)