Example usage for android.app AlertDialog.Builder show

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

Introduction

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

Prototype

public void show() 

Source Link

Document

Start the dialog and display it on screen.

Usage

From source file:com.javierc.albuquerquenow.TransitMap.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // TODO Auto-generated method stub
    if (item.getItemId() == R.id.offline_routes) {

        if (item.isChecked()) {
            item.setChecked(false);/*from   w ww  .  j  a  v a 2  s .  c  om*/
            useOfflineRoutes = false;
        } else {
            item.setChecked(true);
            useOfflineRoutes = true;
        }

    } else if (item.getItemId() == R.id.action_legalnotices) {
        String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(TransitMap.this);
        LicenseDialog.setTitle("Legal Notices");
        LicenseDialog.setMessage(LicenseInfo);
        LicenseDialog.show();

    } else if (item.getItemId() == R.id.bus_refresh) {
        //first delete all the current markers
        refreshMarkers();
        //plot new markers
        plotBus(actionBar.getSelectedNavigationIndex());

    } else if (item.getItemId() == R.id.bus_stops) {
        new PlotStopsTask(this).execute();
    }
    return super.onOptionsItemSelected(item);
}

From source file:nf.frex.android.FrexActivity.java

public static void showYesNoDialog(Context context, int titleId, String message,
        DialogInterface.OnClickListener yesListener, DialogInterface.OnClickListener noListener,
        DialogInterface.OnCancelListener cancelListener) {

    TextView textView = new TextView(context);
    textView.setSingleLine(false);//from   ww w.j ava 2s.  co  m
    textView.setPadding(10, 10, 10, 10);
    textView.setText(message);

    AlertDialog.Builder b = new AlertDialog.Builder(context);
    b.setTitle(titleId);
    b.setView(textView);
    b.setCancelable(true);
    if (yesListener != null) {
        b.setPositiveButton(android.R.string.yes, yesListener);
    }
    if (noListener != null) {
        b.setNegativeButton(android.R.string.no, noListener);
    }
    if (cancelListener != null) {
        b.setOnCancelListener(cancelListener);
    }
    b.show();
}

From source file:co.dilaver.quoter.fragments.PopularFragment.java

@Override
public void pqInfoClicked() {
    android.app.AlertDialog.Builder builder = new android.app.AlertDialog.Builder(getActivity());
    builder.setTitle(getString(R.string.str_Info));
    builder.setMessage(Html.fromHtml(getString(R.string.str_TakenFromReddit)));
    builder.setCancelable(true);/*w w  w  . ja  va 2  s.  c om*/
    builder.show();
}

From source file:com.locution.hereyak.LoginActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_legalnotices:
        String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(this);
        LicenseDialog.setTitle("Legal Notices");
        LicenseDialog.setMessage(LicenseInfo);
        LicenseDialog.show();
        return true;
    }/*from  www.  j av  a 2s . com*/
    return super.onOptionsItemSelected(item);
}

From source file:com.example.maproot.MainActivity.java

public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case MENU_A:/*from  ww w .  j  a v a2  s . co  m*/
        //show_mapInfo();
        return true;

    case MENU_B:
        //Legal Notices(?)

        String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(MainActivity.this);
        LicenseDialog.setTitle("Legal Notices");
        LicenseDialog.setMessage(LicenseInfo);
        LicenseDialog.show();

        return true;

    case MENU_c:
        //show_settings();
        return true;

    }
    return false;
}

From source file:com.vishnuvalleru.travelweatheralertsystem.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch (item.getItemId()) {
    case R.id.menu_legalnotices:
        String LicenseInfo = GooglePlayServicesUtil.getOpenSourceSoftwareLicenseInfo(getApplicationContext());
        AlertDialog.Builder LicenseDialog = new AlertDialog.Builder(MainActivity.this);
        LicenseDialog.setTitle("Legal Notices");
        LicenseDialog.setMessage(LicenseInfo);
        LicenseDialog.show();
        return true;
    }/*from  w w  w. j  ava 2  s.  c  o  m*/
    return super.onOptionsItemSelected(item);
}

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   www  .j a  va 2 s.  c  o  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.yairkukielka.feedhungry.EntryListFragment.java

private void showErrorDialog(String error) {
    AlertDialog.Builder b = new AlertDialog.Builder(getActivity());
    b.setMessage(getResources().getString(R.string.generic_exception));
    b.show();
}

From source file:com.googlecode.android_scripting.facade.ui.SeekBarDialogTask.java

@Override
public void onCreate() {
    super.onCreate();
    mSeekBar = new SeekBar(getActivity());
    mSeekBar.setMax(mMax);/*from   www  . j  ava  2  s  .com*/
    mSeekBar.setProgress(mProgress);
    mSeekBar.setPadding(10, 0, 10, 3);
    mSeekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {

        public void onStopTrackingTouch(SeekBar arg0) {
        }

        public void onStartTrackingTouch(SeekBar arg0) {
        }

        public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
            EventFacade eventFacade = getEventFacade();
            if (eventFacade != null) {
                JSONObject result = new JSONObject();
                try {
                    result.put("which", "seekbar");
                    result.put("progress", mSeekBar.getProgress());
                    result.put("fromuser", fromUser);
                    eventFacade.postEvent("dialog", result);
                } catch (JSONException e) {
                    Log.e(e);
                }
            }
        }
    });

    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    if (mTitle != null) {
        builder.setTitle(mTitle);
    }
    if (mMessage != null) {
        builder.setMessage(mMessage);
    }
    builder.setView(mSeekBar);
    configureButtons(builder, getActivity());
    addOnCancelListener(builder, getActivity());
    mDialog = builder.show();
    mShowLatch.countDown();
}

From source file:com.restswitch.controlpanel.MainActivity.java

private void alertError(String msg) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle("Error");
    builder.setMessage(msg);//from   w  w  w  .  j av a  2 s .  c  om
    builder.setNeutralButton("OK", null);
    builder.setIcon(android.R.drawable.ic_dialog_alert);
    builder.show();
}