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.abc.driver.PersonalActivity.java

public void updateIdentityImage(View v) {
    AlertDialog.Builder builder = new AlertDialog.Builder(this);
    builder.setTitle(res.getString(R.string.choose_portrait));
    builder.setItems(new String[] { res.getString(R.string.getPhotoFromCamera),
            res.getString(R.string.getPhotoFromMemory) }, new DialogInterface.OnClickListener() {
                // @Override
                public void onClick(DialogInterface dialog, int id) {
                    switch (id) {
                    case 0:
                        startToCameraActivity(CellSiteConstants.TAKE_IDENTITY);
                        break;
                    case 1:
                        startToMediaActivity(CellSiteConstants.PICK_IDENTITY);
                        break;
                    }/*from  w w  w  .jav a2  s.  c  o m*/
                }

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

From source file:net.evecom.androidecssp.base.BaseActivity.java

/**
 * //from  w w  w. ja  v  a2s . c  o  m
 * 
 * @param errorMsg
 */
protected void dialogToast(String errorMsg, final ICallback callback) {
    AlertDialog.Builder builder1 = new AlertDialog.Builder(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) {
            if (null != callback) {
                callback.execute();
            }
        }
    });
    builder1.show();
}

From source file:com.sweetiepiggy.raspberrybusmalaysia.SubmitTripActivity.java

private void submit() {
    final String sched_time = format_time(mData.sched_time);
    final String depart_time = format_time(mData.depart_time);
    final String arrival_time = format_time(mData.arrival_time);
    final String agent = ((AutoCompleteTextView) findViewById(R.id.agent_entry)).getText().toString();
    final String operator = ((AutoCompleteTextView) findViewById(R.id.operator_entry)).getText().toString();
    final String from_station = ((AutoCompleteTextView) findViewById(R.id.from_station_entry)).getText()
            .toString();/*from   w  w  w  . j  a v  a2  s.  com*/
    final String to_station = ((AutoCompleteTextView) findViewById(R.id.to_station_entry)).getText().toString();
    final String safety = Integer.toString((int) ((RatingBar) findViewById(R.id.safety_bar)).getRating());
    final String comfort = Integer.toString((int) ((RatingBar) findViewById(R.id.comfort_bar)).getRating());
    final String overall = Integer.toString((int) ((RatingBar) findViewById(R.id.overall_bar)).getRating());
    final String comment = ((EditText) findViewById(R.id.comment_entry)).getText().toString();

    String disp_sched = DateFormat.getTimeFormat(getApplicationContext()).format(mData.sched_time.getTime());
    String trip_time = format_time(
            (mData.arrival_time.getTimeInMillis() - mData.sched_time.getTimeInMillis()) / 1000);
    String delay = format_time_min(
            (mData.depart_time.getTimeInMillis() - mData.sched_time.getTimeInMillis()) / 1000);
    String info = getResources().getString(R.string.sched_time) + ": " + disp_sched + "\n"
            + getResources().getString(R.string.trip_time) + ": " + trip_time + "\n"
            + getResources().getString(R.string.delay) + ": " + delay;

    AlertDialog.Builder alert = new AlertDialog.Builder(this);
    alert.setTitle(R.string.confirm_submit);
    alert.setMessage(info);
    alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            String msg = format_email(agent, operator, from_station, to_station, sched_time, depart_time,
                    arrival_time, safety, comfort, overall, comment);

            new PostTask(getApplicationContext(), msg).execute();
        }
    });
    alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
        }
    });
    alert.show();
}

From source file:com.nps.micro.view.TestsSectionFragment.java

private void prepareScenarios() {
    ScenariosGenerator scenariosGeneratior = new ScenariosGenerator(model);
    final List<Scenario> scenarios = scenariosGeneratior.generate();
    List<CharSequence> items = new ArrayList<CharSequence>();
    for (Scenario scenario : scenarios) {
        items.add(scenario.toString());//from w  w  w. ja va  2 s .  c om
    }
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    builder.setTitle(R.string.test_scenatios_title)
            .setItems(items.toArray(new CharSequence[items.size()]), new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // Do nothing
                }
            }).setPositiveButton(R.string.run, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    if (listener != null) {
                        listener.runUsbTest(scenarios);
                    }
                }
            }).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int id) {
                    dialog.dismiss();
                }
            });
    builder.create().show();
}

From source file:edu.missouri.niaaa.ema.activity.AdminManageActivity.java

private Dialog assignConfirmDialog(Context context, String str, boolean startNewWeek) {

    LayoutInflater inflater = LayoutInflater.from(context);
    final View textEntryView = inflater.inflate(R.layout.remove_id, null);
    final CheckBox rm_check = (CheckBox) textEntryView.findViewById(R.id.rm_local);
    rm_check.setText(R.string.assign_new_week);
    AlertDialog.Builder builder = new AlertDialog.Builder(context);
    if (startNewWeek) {
        builder.setView(textEntryView);/*w  ww .  ja v  a  2  s. c o  m*/
    }
    builder.setCancelable(false);
    builder.setTitle(R.string.assign_confirm_title);
    builder.setMessage(str);
    builder.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int whichButton) {
            editor.putString(Utilities.SP_KEY_LOGIN_USERID, asID.getText().toString());
            Log.d("here!!!", "id is " + asID.getText().toString());
            //format check

            editor.putString(Utilities.SP_KEY_LOGIN_USERPWD, "");
            editor.putString(Utilities.SP_KEY_LOGIN_STUDY_STARTTIME,
                    "" + Calendar.getInstance().getTimeInMillis());
            editor.commit();

            //start new study week, if checked
            if (rm_check.isChecked()) {

                String UID = null;
                try {
                    UID = Utilities.encryption(asID.getText().toString());
                } catch (Exception e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

                ChangeStudyWeek changeStudyWeek = new ChangeStudyWeek();
                changeStudyWeek.execute(UID);
            }

            setHints();
            //continue with set user pin (8)
            setResult(Activity.RESULT_OK);
            finish();
        }
    });

    builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            // TODO Auto-generated method stub
            setHints();
        }
    });
    return builder.create();
}

From source file:com.remobile.dialogs.Notification.java

/**
 * Builds and shows a native Android alert with given Strings
 *
 * @param message         The message the alert should display
 * @param title           The title of the alert
 * @param buttonLabel     The label of the button
 * @param callbackContext The callback context
 *///w w w.j ava  2  s. c  o m
public synchronized void alert(final String message, final String title, final String buttonLabel,
        final CallbackContext callbackContext) {
    Runnable runnable = new Runnable() {
        public void run() {

            AlertDialog.Builder dlg = createDialog(); // new AlertDialog.Builder(this.cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);
            dlg.setMessage(message);
            dlg.setTitle(title);
            dlg.setCancelable(false);
            dlg.setPositiveButton(buttonLabel, new AlertDialog.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 0));
                }
            });
            dlg.setOnCancelListener(new AlertDialog.OnCancelListener() {
                public void onCancel(DialogInterface dialog) {
                    dialog.dismiss();
                    callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, 0));
                }
            });

            changeTextDirection(dlg);
        }

        ;
    };
    this.cordova.getActivity().runOnUiThread(runnable);
}

From source file:com.autburst.picture.MainActivity.java

@Override
protected Dialog onCreateDialog(int id) {
    final Dialog dialog;
    final Context mContext = this;

    switch (id) {

    case DIALOG_CREATE_ALBUM_ID:

        AlertDialog.Builder builder2 = new AlertDialog.Builder(this);
        builder2.setTitle(R.string.new_gallery);

        View view = getLayoutInflater().inflate(R.layout.create_album, null);
        final EditText edit = (EditText) view.findViewById(R.id.albumNameEditText);
        final RadioGroup rg = (RadioGroup) view.findViewById(R.id.formatRadioGroup);

        builder2.setView(view);//from w  ww . j av a2  s. co m

        builder2.setPositiveButton(R.string.save, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {

                String name = edit.getText().toString();
                Log.d(TAG, "Entered name: " + name);

                // base64 encode string
                String encodedName = new String(Base64.encodeBase64(name.getBytes()));
                Log.d(TAG, "base64 encoded name: " + encodedName);

                // check if album with the same name already exist
                if (Utilities.existsAlbumName(encodedName)) {
                    // fehler
                    showDialog(DIALOG_ALBUM_NAME_ALREADY_EXIST);
                    return;
                }

                // create folder
                Utilities.getAlbumDirectory(encodedName);

                // get format
                int checkedRadioButtonId = rg.getCheckedRadioButtonId();
                final Boolean portrait;
                if (checkedRadioButtonId == R.id.portraitRB)
                    portrait = true;
                else
                    portrait = false;

                SharedPreferences settings = getSharedPreferences(Utilities.PIC_STORE, 0);
                Editor edit2 = settings.edit();
                edit2.putBoolean(encodedName + ".portrait", portrait);
                edit2.putFloat(encodedName + ".frameRate", Utilities.MEDIUM_FRAME_RATE);
                edit2.commit();
                Log.d(TAG, "portrait: " + portrait + " settingsname: " + encodedName + ".portrait frameRate: "
                        + Utilities.MEDIUM_FRAME_RATE);

                // reset editView
                edit.setText("");

                // update table
                adapter.add(encodedName);
                adapter.sort(Utilities.getAlbumNameComparator());
                adapter.notifyDataSetChanged();

                dialog.dismiss();

                controller.transformGUI(MainActivityController.CREATED_ALBUM);
            }
        });
        builder2.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                dialog.dismiss();
                // reset editView
                edit.setText("");
                // showDialog(DIALOG_CREATE_ALBUM_ID);
            }
        });

        AlertDialog create = builder2.create();
        dialog = create;

        break;
    case DIALOG_ALBUM_NAME_ALREADY_EXIST:
        AlertDialog.Builder builder3 = new AlertDialog.Builder(this);
        builder3.setTitle(R.string.warning);
        builder3.setMessage(R.string.gallery_exists);
        builder3.setNegativeButton("Ok", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                // dialog.dismiss();
                showDialog(DIALOG_CREATE_ALBUM_ID);
            }
        });

        dialog = builder3.create();
        break;
    default:
        dialog = null;
    }

    return dialog;
}

From source file:net.evecom.androidecssp.base.BaseActivity.java

/**
 * //from  w w  w  . ja  v a2s .co m
 * 
 * @param errorMsg
 */
protected void dialogPickToast(String title, String msg, String ymsg, String nmsg,
        final IPickCallback callback) {
    AlertDialog.Builder builder1 = new AlertDialog.Builder(this);
    builder1.setTitle(title);
    builder1.setIcon(R.drawable.qq_dialog_default_icon);// 
    builder1.setMessage(msg);
    builder1.setPositiveButton(ymsg, new DialogInterface.OnClickListener() {
        // @Override
        public void onClick(DialogInterface dialog, int which) {
            if (null != callback) {
                callback.yes();
            }
        }
    });
    builder1.setNegativeButton(nmsg, new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            callback.no();
        }
    });
    builder1.show();
}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment31.java

private void successDialog(int i) {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());

    if (i == 2 || i == 3) {
        alertDialog.setTitle(" ? ");
        alertDialog.setMessage("? ?  ??");
    } else if (i == 1) {
        alertDialog.setTitle("  ");
        alertDialog.setMessage("? ?  ?");
    } else if (i == 4) {
        alertDialog.setTitle("  ");
        alertDialog.setMessage("? ? ?");
    }/*from   w  w w  .j  av  a  2s.  c o  m*/

    alertDialog.setIcon(R.drawable.ic_dialog_alert);

    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to invoke YES event
            dialog.cancel();
            getMyBeaconList();
        }
    });

    alertDialog.show();
}

From source file:br.liveo.ndrawer.ui.fragment.MainFragment31.java

private void failDialog(int i) {
    AlertDialog.Builder alertDialog = new AlertDialog.Builder(getActivity());

    if (i == 2 || i == 3) {
        alertDialog.setTitle("  ? ");
        alertDialog.setMessage("? ? ");
    } else if (i == 1) {
        alertDialog.setTitle("   ");
        alertDialog.setMessage(" ? ");
    } else if (i == 4) {
        alertDialog.setTitle("  ");
        alertDialog.setMessage(" ? ");
    }/*from w ww  .  ja  v  a2s  .  co  m*/

    alertDialog.setIcon(R.drawable.fail);

    // Setting Positive "Yes" Button
    alertDialog.setPositiveButton("", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            // Write your code here to invoke YES event
            dialog.cancel();
        }
    });

    alertDialog.show();
}