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:de.dmxcontrol.fragment.ActionSelectorFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    Log.d(TAG, "onCreateView");

    LinearLayout actionButtons = (LinearLayout) inflater.inflate(R.layout.action_selector_fragment, container,
            false);/*from w  w  w. j  a va  2  s .c om*/

    ViewGroup vg = (ViewGroup) actionButtons.findViewById(R.id.action_selector_scroll);
    scrollView = vg;

    bDeviceAction = (Button) actionButtons.findViewById(R.id.button_device_action);
    bDeviceAction.setOnClickListener(this);
    bDeviceAction.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            try {
                AlertDialog.Builder alert = new AlertDialog.Builder(v.getContext());
                alert.setTitle("Parameter");
                final DeviceManagerDialog view = new DeviceManagerDialog(alert.getContext());
                alert.setView(view);
                alert.setPositiveButton("OK", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int whichButton) {
                        try {
                            ServiceFrontend.get().sendMessage(view.GetDeviceMetadata().getBytes());
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                });
                AlertDialog alertDialog = alert.create();
                alertDialog.show();
                return true;
            } catch (Exception e) {
                return false;
            }
        }
    });

    bColorAction = (Button) actionButtons.findViewById(R.id.button_color_action);
    bColorAction.setOnClickListener(this);

    bIntensityAction = (Button) actionButtons.findViewById(R.id.button_intensity_action);
    bIntensityAction.setOnClickListener(this);

    bPanTiltAction = (Button) actionButtons.findViewById(R.id.button_pantilt_action);
    bPanTiltAction.setOnClickListener(this);

    bGoboAction = (Button) actionButtons.findViewById(R.id.button_gobo_action);
    bGoboAction.setOnClickListener(this);

    bOpticAction = (Button) actionButtons.findViewById(R.id.button_optic_action);
    bOpticAction.setOnClickListener(this);

    bPrismAction = (Button) actionButtons.findViewById(R.id.button_prism_action);
    bPrismAction.setOnClickListener(this);
    //bOpticAction.setVisibility(View.INVISIBLE);
    //actionButtons.removeView(bOpticAction);

    bRawAction = (Button) actionButtons.findViewById(R.id.button_raw_action);
    bRawAction.setOnClickListener(this);
    //bRawAction.setVisibility(View.INVISIBLE);
    //actionButtons.removeView(bRawAction);

    bEffectAction = (Button) actionButtons.findViewById(R.id.button_effect_action);
    bEffectAction.setOnClickListener(this);
    //bEffectAction.setVisibility(View.INVISIBLE);
    //actionButtons.removeView(bEffectAction);

    bPresetAction = (Button) actionButtons.findViewById(R.id.button_preset_action);
    bPresetAction.setOnClickListener(this);

    bProgrammerAction = (Button) actionButtons.findViewById(R.id.button_programmer_action);
    bProgrammerAction.setOnClickListener(this);

    updateStateSelected();
    return actionButtons;
}

From source file:com.kuaichumen.whistle.admin.CaptureActivity.java

private void displayFrameworkBugMessageAndExit() {
    // camera error
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(getString(com.kuaichumen.whistle.R.string.app_name));
    builder.setMessage("???");
    builder.setPositiveButton("", new DialogInterface.OnClickListener() {

        @Override//from   w w w.j ava 2 s  . c  o  m
        public void onClick(DialogInterface dialog, int which) {
            finish();
        }

    });
    builder.setOnCancelListener(new DialogInterface.OnCancelListener() {

        @Override
        public void onCancel(DialogInterface dialog) {
            finish();
        }
    });
    builder.show();
}

From source file:com.otaupdater.SettingsActivity.java

private void showGetProKeyDialog() {
    if (cfg.hasProKey())
        return;/*  w ww.  j  a  v  a2  s  .co  m*/

    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(R.string.settings_prokey_title);
    final boolean playServices = Utils.checkPlayServices(this);
    builder.setItems(playServices ? R.array.prokey_ops : R.array.prokey_ops_nomarket,
            new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    which -= playServices ? 1 : 0;
                    switch (which) {
                    case -1:
                        try {
                            Bundle buyIntentBundle = service.getBuyIntent(3, getPackageName(),
                                    Config.PROKEY_SKU, "inapp", null);
                            PendingIntent buyIntent = buyIntentBundle.getParcelable("BUY_INTENT");
                            if (buyIntent != null)
                                startIntentSenderForResult(buyIntent.getIntentSender(), PROKEY_REQ_CODE,
                                        new Intent(), 0, 0, 0);
                        } catch (Exception e) {
                            Toast.makeText(SettingsActivity.this, R.string.prokey_error_init,
                                    Toast.LENGTH_SHORT).show();
                        }
                        break;
                    case 0:
                        redeemProKey();
                        break;
                    //                case 1:
                    //                    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Config.SITE_BASE_URL + Config.DONATE_URL)));
                    //                    break;
                    }
                }
            });

    final AlertDialog dlg = builder.create();
    dlg.setOnShowListener(new DialogInterface.OnShowListener() {
        @Override
        public void onShow(DialogInterface dialog) {
            onDialogShown(dlg);
        }
    });
    dlg.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            onDialogClosed(dlg);
        }
    });
    dlg.show();
}

From source file:com.meycup.ducksound.BackgroundSearch.java

@Override
protected void onPostExecute(final String[][] strings) {
    if (strings[0][0].equals("error_on_search")) {

        if (strings[0][1].equals("")) {

            tv.setVisibility(View.VISIBLE);
            listView.setAdapter(null);//from w w w . j  a  v a2s .  c  om

        } else {

            AlertDialog.Builder alert = new AlertDialog.Builder(context);

            alert.setTitle("Ocorreu um erro!");
            alert.setMessage(strings[0][1]);

            alert.setPositiveButton("Tentar novamente", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    BackgroundSearch research = new BackgroundSearch(context, listView, play_bar, tv);
                    research.execute(search);
                    dialog.dismiss();
                }
            });

            alert.setNegativeButton("Sair", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    System.exit(0);
                }
            });

            alert.setNeutralButton("Ok", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                }
            });

            alert.show();
        }

    } else {

        if (tv != null) {
            tv.setVisibility(View.INVISIBLE);
        }

        int count = 0;
        for (int i = 0; i < strings[0].length; i++) {
            if (strings[0][i] != null) {
                count++;
            }
        }

        ListAdapter adp = new ListAdapter(context, strings, new String[count]);
        listView.setAdapter(adp);

        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                if (strings[position + 1][6].equals("true")) {
                    try {
                        if (player != null) {
                            player.stop();
                            player = new Player(play_bar, strings[position + 1][2], strings[0][position],
                                    (!strings[position + 1][4].equals("null")) ? strings[position + 1][4]
                                            : strings[position + 1][3],
                                    true);
                        } else {
                            player = new Player(play_bar, strings[position + 1][2], strings[0][position],
                                    (!strings[position + 1][4].equals("null")) ? strings[position + 1][4]
                                            : strings[position + 1][3],
                                    true);
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                } else {
                    AlertDialog.Builder alert = new AlertDialog.Builder(context);
                    alert.setMessage("Desculpe, no  possvel reproduzir essa msica, escolha outra.");
                    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                            dialog.dismiss();
                        }
                    });

                    alert.show();
                }

            }
        });
    }

    listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            if (strings[position + 1][6].equals("true")) {
                File dir = new File(Environment.getExternalStorageDirectory() + "/Ducksound");

                if (!dir.exists()) {
                    dir.mkdirs();
                }

                final DownloadManager DM = (DownloadManager) context.getSystemService(context.DOWNLOAD_SERVICE);

                String download_url;

                if (strings[position + 1][0].equals("true")) {
                    download_url = strings[position + 1][5] + "?client_id=" + MainActivity.CLIENT_ID;
                } else {
                    download_url = "http://188.138.17.231/~krafta/dow.php?url=" + strings[position + 1][2]
                            + "?client_id=" + MainActivity.CLIENT_ID + "&name="
                            + URLEncoder.encode(strings[0][position] + "(Ducksound)");
                }

                Uri uri = Uri.parse(download_url.replace("https://", "http://"));

                final DownloadManager.Request request = new DownloadManager.Request(uri);

                request.setAllowedNetworkTypes(
                        DownloadManager.Request.NETWORK_WIFI | DownloadManager.Request.NETWORK_MOBILE)
                        .setAllowedOverRoaming(false).setTitle(strings[0][position])
                        .setDestinationInExternalPublicDir("/Ducksound",
                                strings[0][position].replace(" ", "_").replace(",", "_").replace("", "c")
                                        .replace("'", "_") + " ("
                                        + context.getResources().getString(R.string.app_name) + ").mp3");

                AlertDialog.Builder download = new AlertDialog.Builder(context);

                download.setTitle("Baixar \"" + strings[0][position] + "\"?");
                download.setMessage("Tem certeza que deseja baixar essa msica?\nEla ser salva em "
                        + Environment.getExternalStorageDirectory().getAbsolutePath() + "/Ducksound");

                download.setPositiveButton("Baixar", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        DM.enqueue(request);
                        dialogInterface.dismiss();
                    }
                });

                download.setNegativeButton("Cancelar", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        dialogInterface.dismiss();
                    }
                }).show();

            } else {
                AlertDialog.Builder alert = new AlertDialog.Builder(context);
                alert.setMessage("Desculpe, no  possvel baixar essa msica, escolha outra.");
                alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                });

                alert.show();
            }

            return true;
        }
    });

    progress.hide();
}

From source file:net.evecom.android.log.DailyLogAddActivity.java

/**
 * //w  w w  .  java 2  s . com
 * 
 * @param errorMsg
 */
private void DialogToast(String errorMsg) {
    AlertDialog.Builder builder1 = new AlertDialog.Builder(DailyLogAddActivity.this);
    builder1.setTitle("");
    builder1.setIcon(R.drawable.qq_dialog_default_icon);// 
    builder1.setMessage("" + errorMsg);
    builder1.setPositiveButton("", new DialogInterface.OnClickListener() {
        // @Override
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    builder1.show();
}

From source file:com.nokia.example.capturetheflag.Controller.java

@Override
public void onError(JSONResponse error) {
    Log.w(TAG, "onError()");

    AlertDialog.Builder errordialog = new AlertDialog.Builder(getActivity());
    errordialog.setTitle("Error");

    if (error.getErrorCode() == JSONResponse.ERROR_GAME_FULL) {
        errordialog.setMessage(getString(R.string.game_full));
    } else if (error.getErrorCode() == JSONResponse.ERROR_EXCEPTION) {
        errordialog.setMessage(error.getException().getMessage());
    }//from  w  w w  .  java 2  s.  c  om

    errordialog.setPositiveButton(getString(android.R.string.ok), new OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
            MainActivity m = (MainActivity) getActivity();
            m.showGameMenu(null);
        }
    });

    errordialog.create().show();
}

From source file:com.doplgangr.secrecy.settings.SettingsFragment.java

void choosePath(final getFileListener listener) {
    AlertDialog.Builder builderSingle = new AlertDialog.Builder(context);
    builderSingle.setTitle(context.getString(R.string.Settings__select_storage_title));
    final ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(context,
            R.layout.select_dialog_singlechoice);
    final Map<String, File> storages = Util.getAllStorageLocations();
    for (String key : storages.keySet()) {
        arrayAdapter.add(key);/* w w w.ja  v a  2  s.c om*/
    }
    builderSingle.setNegativeButton(R.string.CANCEL, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.dismiss();
        }
    });

    builderSingle.setAdapter(arrayAdapter, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            String strName = arrayAdapter.getItem(which);
            File file = storages.get(strName);
            listener.get(file);
        }
    });
    builderSingle.show();
}

From source file:com.mobile.godot.activity.LauncherActivity.java

private AlertDialog buildDialogUserRegistration() {

    AlertDialog dialogUserRegistration;/* w  w  w .  j  a  v a2s  .  c o  m*/

    AlertDialog.Builder builderDialogUserRegistration = new AlertDialog.Builder(this);
    builderDialogUserRegistration.setTitle(R.string.dilog_title_user_registration)
            .setIcon(R.drawable.ic_launcher);

    LayoutInflater inflaterDialogUserRegistration = (LayoutInflater) this
            .getSystemService(LAYOUT_INFLATER_SERVICE);
    View contentDialogUserRegistration = inflaterDialogUserRegistration.inflate(
            R.layout.dialog_user_registration, (ViewGroup) findViewById(R.id.dialog_user_registration_root));
    builderDialogUserRegistration.setView(contentDialogUserRegistration);

    final EditText etFirstname = (EditText) contentDialogUserRegistration.findViewById(R.id.etFirstname);
    final EditText etLastname = (EditText) contentDialogUserRegistration.findViewById(R.id.etLastname);
    final EditText etMail = (EditText) contentDialogUserRegistration.findViewById(R.id.etMail);
    final EditText etUsername = (EditText) contentDialogUserRegistration.findViewById(R.id.etUsername);
    final EditText etPassword = (EditText) contentDialogUserRegistration.findViewById(R.id.etPassword);

    builderDialogUserRegistration.setPositiveButton(R.string.register, new DialogInterface.OnClickListener() {

        public void onClick(DialogInterface dialog, int id) {

            String firstname = etFirstname.getText().toString();
            String lastname = etLastname.getText().toString();
            String mail = etMail.getText().toString();
            String username = etUsername.getText().toString();
            String password = etPassword.getText().toString();

            UserBean user = new UserBean().setFirstname(firstname).setLastname(lastname).setMail(mail)
                    .setUsername(username).setPassword(password);

            registerNewUser(user);

        }

    });

    builderDialogUserRegistration.setNegativeButton(R.string.dialog_button_cancel,
            new DialogInterface.OnClickListener() {

                public void onClick(DialogInterface dialog, int id) {

                    Toast.makeText(getApplicationContext(), R.string.toast_we_would_be_glad, Toast.LENGTH_SHORT)
                            .show();

                }

            });

    dialogUserRegistration = builderDialogUserRegistration.create();

    return dialogUserRegistration;
}

From source file:com.njlabs.amrita.aid.gpms.ui.GpmsActivity.java

public void openApply(View v) {
    final String[] items = { "Day Pass", "Home Pass" };
    AlertDialog.Builder builder = new AlertDialog.Builder(baseContext);
    builder.setCancelable(true);//  w  ww . ja  v  a  2s  .co m
    builder.setTitle("Pass type ?");
    builder.setItems(items, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialogList, int item) {
            Intent intent = new Intent(baseContext, PassApplyActivity.class);
            intent.putExtra("pass_type", items[item]);
            if (relays != null && relays.size() > 0 && identifier != null) {
                intent.putParcelableArrayListExtra("relays", relays);
                intent.putExtra("identifier", identifier);
            }
            startActivity(intent);
        }
    });
    AlertDialog alertDialog = builder.create();
    alertDialog.show();
}

From source file:com.njlabs.amrita.aid.aums.AumsActivity.java

private void semesterPicker(final StringCallback stringCallback) {
    final String[] items = { "1", "2", "Vacation 1", "3", "4", "Vacation 2", "5", "6", "Vacation 3", "7", "8",
            "Vacation 4", "9", "10", "Vacation 5", "11", "12", "Vacation 6", "13", "14", "15" };
    AlertDialog.Builder builder = new AlertDialog.Builder(baseContext);
    builder.setCancelable(true);/*w w w  .  ja  v a2s.c  om*/
    builder.setTitle("Select a Semester");
    builder.setItems(items, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            stringCallback.onFinish(items[which]);
        }
    });
    AlertDialog alertDialog = builder.create();
    alertDialog.show();
}