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:edu.stanford.mobisocial.dungbeetle.obj.action.PlayAllAudioAction.java

public void onAct(Context context, DbEntryHandler objType, DbObj obj) {
    DBHelper helper = DBHelper.getGlobal(context);
    this.context = context;
    JSONObject objData = obj.getJson();// w w  w . j  ava2s  .  c  o m

    //TODO: this cursor really need to be closed somewhere!!!  it may be but its sketchy
    //TODO: holy frickin hell its sketch... slutty code, plus it pulls the full body in as well
    //it should maybe load an objid list and then fetch each voice obj individually.

    String query = DbObject.FEED_NAME + "= ? AND " + DbObject.TYPE + "='voice' AND " + DbObject._ID
            + " >= (SELECT " + DbObject._ID + " FROM " + DbObject.TABLE + " WHERE " + DbObject.FEED_NAME
            + "= ? AND " + DbObject.TYPE + "='voice' AND " + DbObject.SEQUENCE_ID + "= ? AND "
            + DbObject.TIMESTAMP + "= ?)";
    String[] queryParams = new String[] { objData.optString("feedName"), objData.optString("feedName"),
            objData.optString("sequenceId"), objData.optString("timestamp") };
    c = helper.getReadableDatabase().query(DbObject.TABLE, null, query, queryParams, null, null,
            DbObject._ID + " ASC");

    c.moveToFirst();

    /*while(!c.isAfterLast()) {
    Log.w("PlayAllAudioAction", c.getString(c.getColumnIndex(DbObject.JSON)));
    c.moveToNext();
    }*/
    playNextSong();
    //c.close();

    Log.w("PlayAllAudioAction", c.getCount() + " rows");
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    builder.setMessage("Now Playing Voice Messages").setCancelable(false).setNegativeButton("Stop Playing",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                    c.moveToLast();
                    c.moveToNext();
                    mp.stop();
                    mp.release();
                }
            });
    alert = builder.create();
    alert.show();

}

From source file:edu.usf.cutr.opentripplanner.android.tasks.ServerChecker.java

@Override
protected void onPostExecute(String result) {
    if (activity.get() != null) {
        try {/* ww  w.  j a v a2 s . c  o  m*/
            if (progressDialog != null && progressDialog.isShowing()) {
                progressDialog.dismiss();
            }
        } catch (Exception e) {
            Log.e(TAG, "Error in Server Checker PostExecute dismissing dialog: " + e);
        }
    }

    if (showMessage) {
        if (activity.get() != null) {
            AlertDialog.Builder dialog = new AlertDialog.Builder(activity.get());
            dialog.setTitle(context.getResources().getString(R.string.server_checker_info_dialog_title));
            dialog.setMessage(result);
            dialog.setNeutralButton(context.getResources().getString(android.R.string.ok), null);
            dialog.create().show();
        }
    } else {
        if (isWorking) {
            Toast.makeText(context, context.getResources().getString(R.string.server_checker_successful),
                    Toast.LENGTH_SHORT).show();
        } else {
            Toast.makeText(context, context.getResources().getString(R.string.custom_server_error),
                    Toast.LENGTH_SHORT).show();
        }
    }

    if (callback != null) {
        callback.onServerCheckerComplete(result, isWorking);
    }
}

From source file:com.microsoft.windowsazure.messaging.e2etestapp.MainActivity.java

/**
 * Creates a dialog and shows it//  ww w  . j a  va  2s .c  om
 * 
 * @param message
 *            The dialog message
 * @param title
 *            The dialog title
 */
private void createAndShowDialog(String message, String title) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    builder.setMessage(message);
    builder.setTitle(title);
    builder.create().show();
}

From source file:com.android.settings.locationprivacy.LocationPrivacyAdvancedSettings.java

@Override
public boolean onPreferenceClick(Preference preference) {
    if (preference.getKey().equals("lp_settings_advanced_reset")) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage(R.string.lp_settings_advanced_reset_warning)
                .setTitle(R.string.lp_settings_advanced_reset_warning_title)
                .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {

                    @Override//from   ww  w.  j  a va2s . c  om
                    public void onClick(DialogInterface dialog, int which) {
                        lpManager.resetToFactoryDefaults();
                        lpManager = new LocationPrivacyManager(getActivity());
                        startFragment(getParentFragment(), LocationPrivacySettings.class.getName(), 0,
                                new Bundle());

                    }
                }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {

                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        // Do Nothing

                    }
                });
        AlertDialog dialog = builder.create();
        dialog.show();

    } else if (preference.getKey().equals("lp_settings_advanced_settings")) {
        if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity()) != ConnectionResult.SUCCESS) {
            addNotification(GOOGLE_PLAY, R.string.lp_settings_google_play_service);
        }
    }
    return true;
}

From source file:com.jaguarlandrover.auto.remote.vehicleentry.LockActivity.java

public void notififyGuestUsedKey(final String guestUser, final String guestService) {
    AlertDialog.Builder builder = new AlertDialog.Builder(LockActivity.this);
    builder.setInverseBackgroundForced(true);
    builder.setMessage("Remote key used by " + guestUser + "!").setCancelable(true).setPositiveButton("OK",
            new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();/*from ww w . j  av  a 2  s  . com*/
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:com.jaguarlandrover.auto.remote.vehicleentry.LockActivity.java

public void keyUpdate(final UserCredentials userCredentials) {
    AlertDialog.Builder builder = new AlertDialog.Builder(LockActivity.this);
    builder.setInverseBackgroundForced(true);
    builder.setMessage("Key updates have been made").setCancelable(false).setPositiveButton("OK",
            new DialogInterface.OnClickListener() {
                @Override/*from  w  ww .ja va 2s .co m*/
                public void onClick(DialogInterface dialog, int which) {
                    lock_fragment.setButtons(userCredentials);
                }
            });
    AlertDialog alert = builder.create();
    alert.show();
}

From source file:de.grobox.blitzmail.SendActivity.java

private void showError(String text) {
    // close notification first
    mNotifyManager.cancel(0);//w  w  w.ja va2 s.  co  m

    AlertDialog.Builder builder = new AlertDialog.Builder(this);

    builder.setTitle(getString(R.string.app_name) + " - " + getString(R.string.error));
    builder.setMessage(text);
    builder.setIcon(android.R.drawable.ic_dialog_alert);

    // Add the buttons
    builder.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int id) {
            // User clicked Cancel button, close this Activity
            finish();
        }
    });
    // Create and show the AlertDialog
    AlertDialog dialog = builder.create();
    dialog.setCanceledOnTouchOutside(false);
    dialog.show();
}

From source file:org.peterbaldwin.client.android.tinyurl.SendTinyUrlActivity.java

void handleError(Throwable throwable) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    if (throwable instanceof MalformedURLException) {
        builder.setMessage(R.string.message_invalid_url);
    } else {/*  w  w w .  j av a2 s. co m*/
        // TODO: User-friendly error messages
        builder.setMessage(String.valueOf(throwable));
    }
    builder.setPositiveButton(R.string.button_ok, this);
    AlertDialog dialog = builder.create();
    dialog.show();
}

From source file:com.intel.xdk.notification.Notification.java

public void confirm(String message, final String iden, String title, String ok, String cancel) {
    if (bConfirmBusy) {
        final String js = "javascript:var e = document.createEvent('Events');e.initEvent('intel.xdk.notification.confirm.busy',true,true);e.success=false;e.message='busy';e.id='"
                + iden + "';document.dispatchEvent(e);";
        activity.runOnUiThread(new Runnable() {

            public void run() {
                webView.loadUrl(js);//w  w w. jav a 2 s  .  c o m
            }

        });
        return;
    }
    bConfirmBusy = true;

    if (title == null || title.length() == 0)
        title = "Please confirm";
    if (ok == null || ok.length() == 0)
        ok = "OK";
    if (cancel == null || cancel.length() == 0)
        cancel = "Cancel";

    AlertDialog.Builder alertBldr = new AlertDialog.Builder(activity);
    alertBldr.setCancelable(false);
    alertBldr.setMessage(message);
    alertBldr.setTitle(title);
    alertBldr.setPositiveButton(ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            processConfirm(true, iden);
        }
    });
    alertBldr.setNegativeButton(cancel, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            processConfirm(false, iden);
        }
    });
    alertBldr.show();
}