Example usage for android.app AlertDialog.Builder setTitle

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

Introduction

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

Prototype

@Override
    public void setTitle(CharSequence title) 

Source Link

Usage

From source file:com.honeycomb.cocos2dx.Soccer.java

public void askForRate(JSONObject prms) {
    AlertDialog.Builder exitbuilder = new AlertDialog.Builder(this);
    exitbuilder.setTitle("Rate 2 Planes").setMessage(com.honeycomb.cocos2dx.R.string.Rate).setCancelable(false)
            .setPositiveButton("Rate It Now", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    rateButtonClicked(getDict());
                }//from  w  w w  . java  2s  .  c o  m
            }).setNegativeButton("No,Thanks", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.cancel();
                    AndroidNDKHelper.SendMessageWithParameters("rated", getDict());
                }
            });
    AlertDialog stopalert = exitbuilder.create();
    stopalert.show();
}

From source file:com.github.barcodeeye.scan.CaptureActivity.java

/**
 * FIXME: This should be a glass compatible view (Card)
 *///from  w  w  w. ja  va 2  s  .c o m
private void displayFrameworkBugMessageAndExit() {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getString(R.string.app_name));
    builder.setMessage(getString(R.string.msg_camera_framework_bug));
    builder.setPositiveButton(R.string.button_ok, new FinishListener(this));
    builder.setOnCancelListener(new FinishListener(this));
    builder.show();
}

From source file:com.sakisds.icymonitor.activities.ConnectionActivity.java

void showErrorDialog(int title, int message) {
    AlertDialog.Builder dlgAlert = new AlertDialog.Builder(this);
    dlgAlert.setTitle(getResources().getString(title));
    dlgAlert.setMessage(getResources().getString(message));
    dlgAlert.setPositiveButton("OK", null);
    dlgAlert.setCancelable(true);// w w  w .  j ava  2 s .c  o  m
    dlgAlert.create().show();
}

From source file:com.khoahuy.phototag.HomeActivity.java

@Override
protected void processNfcID() {
    if (("").equals(nfcid) || nfcid == null) {
        AlertDialog.Builder builder = new AlertDialog.Builder(HomeActivity.this);
        builder.setTitle("Error");
        builder.setMessage("Dected your tag fail");
        builder.setPositiveButton("Continue", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                // TODO Auto-generated method stub
            }/*from  w  w  w.java2 s  . co  m*/
        });
        builder.show();
    } else if (existedUID(nfcid)) {
        displayNFCItem(nfcid);
    } else {
        dispatchTakePictureIntent(ACTION_TAKE_PHOTO_B);
    }
}

From source file:com.f16gaming.pathofexilestatistics.MainActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);//from w  w w  . j a  v a2 s .c  om

    LayoutInflater inflater = getLayoutInflater();

    poeEntries = new ArrayList<PoeEntry>();

    statsView = (ListView) findViewById(R.id.statsView);

    listFooter = inflater.inflate(R.layout.list_footer, null);

    statsView.addFooterView(listFooter);

    statsView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            onStatsViewClick(position);
        }
    });

    AlertDialog.Builder refreshWarningBuilder = new AlertDialog.Builder(this);
    refreshWarningBuilder.setTitle(R.string.refresh_warning).setMessage(R.string.refresh_warning_message)
            .setCancelable(true)
            .setNegativeButton(R.string.refresh_warning_reset, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    resetList();
                }
            }).setPositiveButton(R.string.refresh_warning_confirm, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    refreshList(true);
                }
            });

    refreshWarningDialog = refreshWarningBuilder.create();

    AlertDialog.Builder rankGoBuilder = new AlertDialog.Builder(this);
    View view = inflater.inflate(R.layout.rank_go_dialog, null);

    numberPicker = (net.simonvt.numberpicker.NumberPicker) view.findViewById(R.id.number_picker);
    numberPicker.setMinValue(1);
    numberPicker.setMaxValue(max);

    rankGoBuilder.setTitle(R.string.rank_go_dialog_title).setView(view).setCancelable(true)
            .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    // Do nothing
                }
            }).setPositiveButton(R.string.go, new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int i) {
                    int rawOffset = numberPicker.getValue() - 1;
                    if (rawOffset >= limit * offset && rawOffset <= limit + limit * offset)
                        showToast(String.format(getString(R.string.toast_rank_showing), rawOffset + 1));
                    else
                        updateList(showHardcore, false, rawOffset);
                }
            });

    rankGoDialog = rankGoBuilder.create();

    resetList();
}

From source file:net.reichholf.dreamdroid.activities.MovieListActivity.java

protected void onListItemClick(ListView l, View v, int position, long id) {
    mMovie = mMapList.get(position);// w  ww  . j  a v a2s . c o  m

    CharSequence[] actions = { getText(R.string.zap), getText(R.string.delete), getText(R.string.stream) };

    AlertDialog.Builder adBuilder = new AlertDialog.Builder(this);
    adBuilder.setTitle(getText(R.string.pick_action));
    adBuilder.setItems(actions, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int which) {
            switch (which) {
            case 0:
                zapTo(mMovie.getString(Movie.REFERENCE));
                break;
            case 1:
                showDialog(DIALOG_DELETE_MOVIE_CONFIRM_ID);
                break;
            case 2:
                streamFile(mMovie.getString(Movie.FILE_NAME));
            default:
                return;
            }
        }
    });

    adBuilder.show();
}

From source file:com.bt.heliniumstudentapp.UpdateClass.java

@Override
protected void onPostExecute(String html) {
    if (html != null) {
        try {/*from   ww  w.java 2s.c  o m*/
            final JSONObject json = (JSONObject) new JSONTokener(html).nextValue();

            versionName = json.optString("version_name");
            final int versionCode = json.optInt("version_code");

            try {
                final int currentVersionCode = context.getPackageManager()
                        .getPackageInfo(context.getPackageName(), 0).versionCode;

                if (versionCode > currentVersionCode) {
                    if (!settings)
                        updateDialog.show();

                    updateDialog.setTitle(context.getString(R.string.update) + ' ' + versionName);

                    final TextView contentTV = (TextView) updateDialog.findViewById(R.id.tv_content_du);
                    contentTV.setTextColor(ContextCompat.getColor(context, MainActivity.themePrimaryTextColor));
                    contentTV.setText(Html.fromHtml(json.optString("content"), null, new Html.TagHandler() {

                        @Override
                        public void handleTag(boolean opening, String tag, Editable output,
                                XMLReader xmlReader) {
                            if ("li".equals(tag))
                                if (opening)
                                    output.append(" \u2022 ");
                                else
                                    output.append("\n");
                        }
                    }));

                    updateDialog.setCanceledOnTouchOutside(true);

                    updateDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(true);

                    updateDialog.getButton(AlertDialog.BUTTON_POSITIVE)
                            .setTextColor(ContextCompat.getColor(context, MainActivity.accentSecondaryColor));
                } else if (settings) {
                    updateDialog.setTitle(context.getString(R.string.update_no));

                    final TextView contentTV = (TextView) updateDialog.findViewById(R.id.tv_content_du);
                    contentTV.setTextColor(ContextCompat.getColor(context, MainActivity.themePrimaryTextColor));
                    contentTV.setText(Html.fromHtml(json.optString("content"), null, new Html.TagHandler() {

                        @Override
                        public void handleTag(boolean opening, String tag, Editable output,
                                XMLReader xmlReader) {
                            if ("li".equals(tag))
                                if (opening)
                                    output.append(" \u2022 ");
                                else
                                    output.append("\n");
                        }
                    }));

                    updateDialog.setCanceledOnTouchOutside(true);
                }
            } catch (NameNotFoundException e) {
                Toast.makeText(context, R.string.error, Toast.LENGTH_SHORT).show();
            }
        } catch (JSONException e) {
            Toast.makeText(context, R.string.error, Toast.LENGTH_SHORT).show();
        }
    } else if (settings) {
        updateDialog.cancel();

        final AlertDialog.Builder updateDialogBuilder = new AlertDialog.Builder(
                new ContextThemeWrapper(context, MainActivity.themeDialog));

        updateDialogBuilder.setTitle(context.getString(R.string.update));

        updateDialogBuilder.setMessage(R.string.error_update);

        updateDialogBuilder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {

            @Override
            public void onClick(DialogInterface dialog, int which) {
                downloadAPK();
            }
        });

        updateDialogBuilder.setNegativeButton(android.R.string.no, null);

        final AlertDialog updateDialog = updateDialogBuilder.create();

        updateDialog.setCanceledOnTouchOutside(true);
        updateDialog.show();

        updateDialog.getButton(AlertDialog.BUTTON_POSITIVE)
                .setTextColor(ContextCompat.getColor(context, MainActivity.accentSecondaryColor));
        updateDialog.getButton(AlertDialog.BUTTON_NEGATIVE)
                .setTextColor(ContextCompat.getColor(context, MainActivity.accentSecondaryColor));
    }
}

From source file:com.ritul.truckshare.RegisterActivity.DriverLicenseActivity.java

public void Image_Picker_Dialog() {

    AlertDialog.Builder myAlertDialog = new AlertDialog.Builder(this);
    myAlertDialog.setTitle("Pictures Option");
    myAlertDialog.setMessage("Select Picture Mode");

    myAlertDialog.setPositiveButton("Gallery", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface arg0, int arg1) {
            /* Utility.pictureActionIntent = new Intent(Intent.ACTION_GET_CONTENT, null);
             Utility.pictureActionIntent.setType("image*//*");
                                                          Utility.pictureActionIntent.putExtra("return-data", true);
                                                          startActivityForResult(Utility.pictureActionIntent, Utility.GALLERY_PICTURE);*/
            Intent i7 = new Intent(Intent.ACTION_PICK,
                    android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
            startActivityForResult(i7, Utility.GALLERY_PICTURE);
        }//from  w  w w.j  a v a  2 s.  c o  m
    });

    myAlertDialog.setNegativeButton("Camera", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface arg0, int arg1) {
            /*Utility.pictureActionIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(Utility.pictureActionIntent, Utility.CAMERA_PICTURE);*/

            Intent cameraIntent1 = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
            startActivityForResult(cameraIntent1, Utility.CAMERA_PICTURE);

        }
    });
    myAlertDialog.show();

}

From source file:ota.otaupdates.MainActivity.java

private void trigger_autoinstall(final String file_path) {
    final SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
    final CoordinatorLayout coordinator_root = (CoordinatorLayout) findViewById(R.id.coordinator_root);
    if (sharedPreferences.getBoolean("enable_auto_install", true)) {
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle(getString(R.string.auto_install_title));
        builder.setMessage(getString(R.string.auto_install_message));
        builder.setPositiveButton(getString(R.string.button_yes), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {

                if (Shell.SU.available()) {
                    Shell.SU.run("rm -rf /cache/recovery/openrecoveryscript");
                    Shell.SU.run("echo \"install " + file_path + "\" >> /cache/recovery/openrecoveryscript");

                    if (sharedPreferences.getBoolean("wipe_cache", true))
                        Shell.SU.run("echo \"wipe cache\" >> /cache/recovery/openrecoveryscript");

                    if (sharedPreferences.getBoolean("wipe_dalvik", true))
                        Shell.SU.run("echo \"wipe dalvik\" >> /cache/recovery/openrecoveryscript");

                    if (sharedPreferences.getBoolean("auto_reboot", true))
                        Shell.SU.run("reboot recovery");
                } else {
                    sb_no_su = Snackbar.make(coordinator_root, "SU access is not available",
                            Snackbar.LENGTH_SHORT);
                    sb_no_su.getView()/* w  ww. jav a  2 s.c  om*/
                            .setBackgroundColor(ContextCompat.getColor(MainActivity.this, R.color.colorSecond));
                    sb_no_su.show();
                }
            }
        });
        builder.setNegativeButton(getString(R.string.button_no), new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
            }
        });
        AlertDialog alert = builder.create();
        alert.setCancelable(false);
        alert.show();
    }
}