Example usage for android.app AlertDialog.Builder setMessage

List of usage examples for android.app AlertDialog.Builder setMessage

Introduction

In this page you can find the example usage for android.app AlertDialog.Builder setMessage.

Prototype

public void setMessage(CharSequence message) 

Source Link

Usage

From source file:net.phamngochai.beefnoodle.ui.DownloadDictionaryActivity.java

public void showAlertDialog(String str) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(str).setCancelable(false).setNeutralButton("OK", null);
    AlertDialog alert = builder.create();
    alert.show();/*from w w w.j a va  2s.com*/
}

From source file:com.mobage.air.extension.AlertDialog_show.java

@Override
public FREObject call(final FREContext context, FREObject[] args) {
    ArgsParser parser = new ArgsParser(args);
    HashMap<String, String> opts = parser.nextKeyValueMap();
    final String onClickId = parser.nextString();
    @SuppressWarnings("unused")
    final String onErrorId = parser.nextString();
    parser.finish();/* ww  w.j  a  v a 2 s.  c  om*/

    AlertDialog.Builder builder = new AlertDialog.Builder(context.getActivity());
    builder.setTitle(opts.get("title"));
    builder.setMessage(opts.get("message"));

    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            JSONArray args = new JSONArray();
            args.put(which);
            Dispatcher.dispatch(context, onClickId, args);
        }
    });
    builder.show();
    return null;
}

From source file:it.evilsocket.dsploit.core.System.java

public static boolean checkNetworking(final Activity current) {
    if (Network.isWifiConnected(mContext) == false) {
        AlertDialog.Builder builder = new AlertDialog.Builder(current);

        builder.setCancelable(false);/*from w ww .  j  ava 2 s  .  com*/
        builder.setTitle("Error");
        builder.setMessage("WiFi connectivity went down.");
        builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();

                Bundle bundle = new Bundle();
                bundle.putBoolean(WifiScannerActivity.CONNECTED, false);

                Intent intent = new Intent();
                intent.putExtras(bundle);

                current.setResult(Activity.RESULT_OK, intent);

                current.finish();
            }
        });

        AlertDialog alert = builder.create();
        alert.show();

        return false;
    }

    return true;
}

From source file:com.gmail.at.faint545.activities.DetailsActivity.java

private AlertDialog buildAlertDialog(String message) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(message);
    builder.setCancelable(false);//w  w w.j  av a 2  s.c  om
    builder.setNegativeButton(R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            finish();
        }
    });
    return builder.create();
}

From source file:org.schtief.partybolle.event.EventManager.java

public void getEvents(String type) {
    GeoPoint center = mapView.getMapCenter();

    //check for Events in Berlin
    if (center.getLatitudeE6() < 52000000 || center.getLatitudeE6() > 53000000
            || center.getLongitudeE6() < 13000000 || center.getLongitudeE6() > 14000000) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this.app);
        builder.setMessage("Alder ick komm aus Berlin, keene Ahnung wat in deinem Kaff los ist!")
                .setCancelable(false)//w w  w. java2s.c o m
                .setPositiveButton("Ich helf dir mit Events fr hier", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                        //TODO twidroid ansprechen
                    }
                }).setNegativeButton("Ok OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                });
        AlertDialog alert = builder.create();
        alert.show();
    }
    int lat1 = center.getLatitudeE6() - mapView.getLatitudeSpan() / 2;
    int lat2 = center.getLatitudeE6() + mapView.getLatitudeSpan() / 2;

    int lon1 = center.getLongitudeE6() - mapView.getLongitudeSpan() / 2;
    int lon2 = center.getLongitudeE6() + mapView.getLongitudeSpan() / 2;

    new GetEventsThread(lat1, lon1, lat2, lon2, type).start();
}

From source file:com.app.swaedes.swaedes.MapPage.java

public void sitesPositionsFetchAlert() {
    AlertDialog.Builder localBuilder = new AlertDialog.Builder(MapPage.this);
    localBuilder.setMessage("Get location of other sites? (if no only current location will be displayed)")
            .setCancelable(false).setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface paramDialogInterface, int paramInt) {
                    MapPage.this.getJsonMarkers();
                }//w ww. jav  a2s. co  m
            });
    localBuilder.setNegativeButton("No", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface paramDialogInterface, int paramInt) {
            paramDialogInterface.cancel();

        }
    });
    localBuilder.create().show();
}

From source file:com.fanfou.app.opensource.service.DownloadService.java

public static void showUpdateConfirmDialog(final Context context, final AppVersionInfo info) {
    final DialogInterface.OnClickListener downListener = new DialogInterface.OnClickListener() {

        @Override/*w w w  .  j  av a 2  s  .c om*/
        public void onClick(final DialogInterface dialog, final int which) {
            DownloadService.startDownload(context, info);
        }
    };
    final AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setTitle("???").setCancelable(true).setNegativeButton("??",
            null);
    builder.setPositiveButton("??", downListener);
    final StringBuffer sb = new StringBuffer();
    sb.append("").append(AppContext.appVersionName).append("(Build")
            .append(AppContext.appVersionCode).append(")");
    sb.append("\n").append(info.versionName).append("(Build").append(info.versionCode)
            .append(")");
    sb.append("\n").append(info.releaseDate);
    sb.append("\n").append(info.forceUpdate ? "???" : "?");
    sb.append("\n\n").append(info.changelog);
    builder.setMessage(sb.toString());
    final AlertDialog dialog = builder.create();
    dialog.show();

}

From source file:jp.ne.sakura.kkkon.android.exceptionhandler.DefaultUploaderWeb.java

public static AlertDialog.Builder setupAlertDialog(final Context context) {
    final AlertDialog.Builder alertDialog = new AlertDialog.Builder(context);
    final Locale defaultLocale = Locale.getDefault();

    String title = "";
    String message = "";
    String positive = "";
    String negative = "";

    boolean needDefaultLang = true;
    if (null != defaultLocale) {
        if (defaultLocale.equals(Locale.JAPANESE) || defaultLocale.equals(Locale.JAPAN)) {
            title = "";
            message = "???????";
            positive = "?";
            negative = "";
            needDefaultLang = false;//from   w  w w  .  j a va2 s.co m
        }
    }
    if (needDefaultLang) {
        title = "INFO";
        message = "Now uploading error information. Cancel upload?";
        positive = "Wait";
        negative = "Cancel";
    }
    alertDialog.setTitle(title);
    alertDialog.setMessage(message);
    alertDialog.setPositiveButton(positive, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface di, int i) {
            if (null != thread) {
                if (thread.isAlive()) {
                    alertDialog.show();
                } else {
                    terminate();
                }
            }
        }
    });

    alertDialog.setNegativeButton(negative, new DialogInterface.OnClickListener() {

        @Override
        public void onClick(DialogInterface di, int i) {
            if (null != thread) {
                if (thread.isAlive()) {
                    Log.d(TAG, "request interrupt");
                    terminate();
                } else {
                    // nothing
                    terminate();
                }
            }
        }
    });

    alertDialog.setCancelable(false);

    return alertDialog;
}

From source file:com.mono.applink.Foursquare.java

/** Called when the activity is first created. */
@Override//from  w ww.j  av a  2 s.c om
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final String url = getIntent().getData().toString();

    if (url.contains("user"))//user with id
    {
        new FoursquareUser().execute();
    } else if (url.contains("venue")) {
        new FoursquareVenue().execute();
    } else {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setMessage("Sorry, but this type of link is not currently supported");
        builder.setOnCancelListener(new OnCancelListener() {
            public void onCancel(DialogInterface dialog) {
                finish();
            }
        });
        builder.setPositiveButton("Open in Browser", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                Intent i = new Intent();
                i.setAction("android.intent.action.VIEW");
                i.addCategory("android.intent.category.BROWSABLE");
                i.setComponent(new ComponentName("com.android.browser", "com.android.browser.BrowserActivity"));
                i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                i.setData(Uri.parse(url));
                startActivity(i);
                finish();
            }
        });
        AlertDialog alert = builder.create();
        alert.show();
    }

}

From source file:com.springsource.greenhouse.twitter.PostTweetActivity.java

private void showResult(String result) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setMessage(result);
    builder.setCancelable(false);/*from w ww.java  2  s  .  c o  m*/
    builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            dialog.cancel();
        }
    });
    AlertDialog alert = builder.create();
    alert.show();
}