List of usage examples for android.text InputType TYPE_CLASS_TEXT
int TYPE_CLASS_TEXT
To view the source code for android.text InputType TYPE_CLASS_TEXT.
Click Source Link
From source file:org.akvo.caddisfly.ui.activity.MainActivity.java
public void onSaveCalibration() { final Context context = this; final MainApp mainApp = (MainApp) this.getApplicationContext(); final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); final EditText input = new EditText(context); input.setInputType(InputType.TYPE_CLASS_TEXT); input.setFilters(new InputFilter[] { new InputFilter.LengthFilter(22) }); alertDialogBuilder.setView(input);/* ww w . ja v a 2s. com*/ alertDialogBuilder.setCancelable(false); alertDialogBuilder.setTitle(R.string.saveCalibration); alertDialogBuilder.setMessage(R.string.giveNameForCalibration); alertDialogBuilder.setPositiveButton(R.string.ok, null); alertDialogBuilder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int i) { closeKeyboard(input); dialog.cancel(); } }); final AlertDialog alertDialog = alertDialogBuilder.create(); //create the box alertDialog.setOnShowListener(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { Button b = alertDialog.getButton(AlertDialog.BUTTON_POSITIVE); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (!input.getText().toString().trim().isEmpty()) { final ArrayList<String> exportList = new ArrayList<String>(); for (ColorInfo aColorList : mainApp.colorList) { exportList.add(ColorUtils.getColorRgbString(aColorList.getColor())); } File external = Environment.getExternalStorageDirectory(); final String path = external.getPath() + Config.CALIBRATE_FOLDER_NAME; File file = new File(path + input.getText()); if (file.exists()) { AlertUtils.askQuestion(context, R.string.overwriteFile, R.string.nameAlreadyExists, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { FileUtils.saveToFile(path, input.getText().toString(), exportList.toString()); } }); } else { FileUtils.saveToFile(path, input.getText().toString(), exportList.toString()); } closeKeyboard(input); alertDialog.dismiss(); } else { input.setError(getString(R.string.invalidName)); } } }); } }); input.setOnEditorActionListener(new TextView.OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if ((event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) || (actionId == EditorInfo.IME_ACTION_DONE)) { } return false; } }); alertDialog.show(); input.requestFocus(); InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); }
From source file:com.grarak.kerneladiutor.fragments.other.SettingsFragment.java
private void deletePasswordDialog(final String password) { if (password.isEmpty()) { Utils.toast(getString(R.string.set_password_first), getActivity()); return;/*from w w w . ja v a2 s. c om*/ } mDeletePassword = password; LinearLayout linearLayout = new LinearLayout(getActivity()); linearLayout.setOrientation(LinearLayout.VERTICAL); linearLayout.setGravity(Gravity.CENTER); int padding = Math.round(getResources().getDimension(R.dimen.dialog_padding)); linearLayout.setPadding(padding, padding, padding, padding); final AppCompatEditText mPassword = new AppCompatEditText(getActivity()); mPassword.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); mPassword.setHint(getString(R.string.password)); linearLayout.addView(mPassword); new Dialog(getActivity()).setView(linearLayout) .setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { if (!mPassword.getText().toString().equals(Utils.decodeString(password))) { Utils.toast(getString(R.string.password_wrong), getActivity()); return; } Prefs.saveString("password", "", getActivity()); if (mFingerprint != null) { mFingerprint.setEnabled(false); } } }).setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialogInterface) { mDeletePassword = null; } }).show(); }
From source file:dev.ukanth.ufirewall.MainActivity.java
/** * Request the password lock before displayed the main screen. */// w w w . ja v a2 s . c o m private void requestPassword() { switch (G.protectionLevel()) { case "p1": new MaterialDialog.Builder(MainActivity.this).cancelable(false).title(R.string.pass_titleget) .autoDismiss(false) .inputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD) .positiveText(R.string.submit).negativeText(R.string.Cancel) .callback(new MaterialDialog.ButtonCallback() { @Override public void onNegative(MaterialDialog dialog) { MainActivity.this.finish(); android.os.Process.killProcess(android.os.Process.myPid()); } }).input(R.string.enterpass, R.string.password_empty, new MaterialDialog.InputCallback() { @Override public void onInput(MaterialDialog dialog, CharSequence input) { String pass = input.toString(); boolean isAllowed = false; if (G.isEnc()) { String decrypt = Api.unhideCrypt("AFW@LL_P@SSWORD_PR0T3CTI0N", G.profile_pwd()); if (decrypt != null) { if (decrypt.equals(pass)) { isAllowed = true; } } } else { if (pass.equals(G.profile_pwd())) { isAllowed = true; } } if (isAllowed) { showOrLoadApplications(); dialog.dismiss(); } else { Api.toast(MainActivity.this, getString(R.string.wrong_password)); } } }).show(); break; case "p2": Intent intent = new Intent(ACTION_COMPARE_PATTERN, null, getApplicationContext(), LockPatternActivity.class); String savedPattern = G.sPrefs.getString("LockPassword", ""); intent.putExtra(EXTRA_PATTERN, savedPattern.toCharArray()); startActivityForResult(intent, REQ_ENTER_PATTERN); break; } }
From source file:ir.actfun.toofan.activities.MainActivity.java
private void searchCities() { final AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(this.getString(R.string.search_title)); final EditText input = new EditText(this); input.setInputType(InputType.TYPE_CLASS_TEXT); input.setMaxLines(1);/*w w w. ja v a 2 s. c om*/ input.setSingleLine(true); alert.setView(input, 32, 0, 32, 0); alert.setPositiveButton(R.string.dialog_ok, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String result = input.getText().toString(); if (!result.isEmpty()) { saveLocation(result); } } }); alert.setNegativeButton(R.string.dialog_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Cancelled } }); alert.show(); }
From source file:jp.watnow.plugins.dialog.Notification.java
/** * //from w ww. j a v a 2 s. c o m * @param message * @param title * @param buttonLabels * @param defaultTexts * @param callbackContext */ public synchronized void login(final String title, final String message, final JSONArray buttonLabels, final JSONArray defaultTexts, final CallbackContext callbackContext) { final CordovaInterface cordova = this.cordova; Runnable runnable = new Runnable() { public void run() { LinearLayout layout = new LinearLayout(cordova.getActivity()); layout.setOrientation(LinearLayout.VERTICAL); layout.setPadding(10, 0, 10, 0); final EditText usernameInput = new EditText(cordova.getActivity()); usernameInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_NORMAL); final EditText passwordInput = new EditText(cordova.getActivity()); passwordInput.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); try { usernameInput.setHint("ID"); usernameInput.setText(defaultTexts.getString(0)); passwordInput.setHint("PASSWORD"); passwordInput.setText(defaultTexts.getString(1)); } catch (JSONException e1) { } layout.addView(usernameInput, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); layout.addView(passwordInput, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); AlertDialog.Builder dlg = createDialog(cordova); // new AlertDialog.Builder(cordova.getActivity(), AlertDialog.THEME_DEVICE_DEFAULT_LIGHT); dlg.setMessage(message); dlg.setTitle(title); dlg.setCancelable(false); dlg.setView(layout); final JSONObject result = new JSONObject(); try { dlg.setNegativeButton(buttonLabels.getString(0), new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); try { result.put("buttonIndex", 1); result.put("input1", usernameInput.getText()); result.put("input2", passwordInput.getText()); } catch (JSONException e) { e.printStackTrace(); } callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result)); } }); } catch (JSONException e) { } try { dlg.setPositiveButton(buttonLabels.getString(1), new AlertDialog.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); try { result.put("buttonIndex", 3); } catch (JSONException e) { e.printStackTrace(); } callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result)); } }); } catch (JSONException e) { } dlg.setOnCancelListener(new AlertDialog.OnCancelListener() { public void onCancel(DialogInterface dialog) { dialog.dismiss(); try { result.put("buttonIndex", 0); } catch (JSONException e) { e.printStackTrace(); } callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result)); } }); changeTextDirection(dlg); }; }; this.cordova.getActivity().runOnUiThread(runnable); }
From source file:com.example.cuisoap.agrimac.homePage.machineDetail.machineInfoFragment.java
private void Unlock() { machine_name.setInputType(InputType.TYPE_CLASS_TEXT); passenger_num.setInputType(InputType.TYPE_CLASS_TEXT); power.setInputType(InputType.TYPE_CLASS_TEXT); wheel_distance.setInputType(InputType.TYPE_CLASS_TEXT); check_time.setInputType(InputType.TYPE_CLASS_TEXT); machine_name.setFocusableInTouchMode(true); passenger_num.setFocusableInTouchMode(true); power.setFocusableInTouchMode(true); wheel_distance.setFocusableInTouchMode(true); check_time.setFocusableInTouchMode(true); license_pic1.setOnClickListener(myOnClickListener); license_pic2.setOnClickListener(myOnClickListener); if (pay_type.getCheckedRadioButtonId() == R.id.machine_paytype1) pay_type2.setEnabled(true);//from ww w . j a v a2 s . c o m else pay_type1.setEnabled(true); if (power_type.getCheckedRadioButtonId() == R.id.machine_powertype1) { power_type2.setEnabled(true); power_type3.setEnabled(true); power_type4.setEnabled(true); } else if (power_type.getCheckedRadioButtonId() == R.id.machine_powertype2) { power_type1.setEnabled(true); power_type3.setEnabled(true); power_type4.setEnabled(true); } else if (power_type.getCheckedRadioButtonId() == R.id.machine_powertype3) { power_type1.setEnabled(true); power_type2.setEnabled(true); power_type4.setEnabled(true); } else if (power_type.getCheckedRadioButtonId() == R.id.machine_powertype4) { power_type1.setEnabled(true); power_type2.setEnabled(true); power_type3.setEnabled(true); } license1.setEnabled(true); license_pic1.setEnabled(true); license2.setEnabled(true); license_pic2.setEnabled(true); machine_type.setEnabled(true); pay_type1.setOnClickListener(myOnClickListener); pay_type2.setOnClickListener(myOnClickListener); power_type1.setOnClickListener(myOnClickListener); power_type2.setOnClickListener(myOnClickListener); power_type3.setOnClickListener(myOnClickListener); power_type4.setOnClickListener(myOnClickListener); }
From source file:org.odk.collect.android.activities.MainMenuActivity.java
@Override protected Dialog onCreateDialog(int id) { switch (id) { case PASSWORD_DIALOG: AlertDialog.Builder builder = new AlertDialog.Builder(this); final AlertDialog passwordDialog = builder.create(); passwordDialog.setTitle(getString(R.string.enter_admin_password)); LayoutInflater inflater = this.getLayoutInflater(); View dialogView = inflater.inflate(R.layout.dialogbox_layout, null); passwordDialog.setView(dialogView, 20, 10, 20, 10); final CheckBox checkBox = (CheckBox) dialogView.findViewById(R.id.checkBox); final EditText input = (EditText) dialogView.findViewById(R.id.editText); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override/*from w w w . j av a 2s.co m*/ public void onCheckedChanged(CompoundButton compoundButton, boolean b) { if (!checkBox.isChecked()) { input.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD); } else { input.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); } } }); passwordDialog.setButton(AlertDialog.BUTTON_POSITIVE, getString(R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString(); String pw = adminPreferences.getString(AdminKeys.KEY_ADMIN_PW, ""); if (pw.compareTo(value) == 0) { Intent i = new Intent(getApplicationContext(), AdminPreferencesActivity.class); startActivity(i); input.setText(""); passwordDialog.dismiss(); } else { ToastUtils.showShortToast(R.string.admin_password_incorrect); Collect.getInstance().getActivityLogger().logAction(this, "adminPasswordDialog", "PASSWORD_INCORRECT"); } } }); passwordDialog.setButton(AlertDialog.BUTTON_NEGATIVE, getString(R.string.cancel), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { Collect.getInstance().getActivityLogger().logAction(this, "adminPasswordDialog", "cancel"); input.setText(""); return; } }); passwordDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); return passwordDialog; } return null; }
From source file:edu.oakland.festinfo.activities.MapPageActivity.java
@AfterViews void init() {//from www . jav a2 s . c o m setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle("Map"); colorUpArrow(); mapKeySpinner = (Spinner) findViewById(R.id.mapkey_spinner); mapKeySpinner.setAdapter(new MyAdapter(MapPageActivity.this, R.layout.row, strings)); ParseInstallation.getCurrentInstallation().saveInBackground(); FragmentManager fragmentManager = getFragmentManager(); mapFragment = (MapFragment) fragmentManager.findFragmentById(R.id.map); map = mapFragment.getMap(); map.setMyLocationEnabled(true); map.setMapType(GoogleMap.MAP_TYPE_HYBRID); map.setOnMapClickListener(this); map.setOnMapLongClickListener(this); map.setOnMarkerDragListener(this); map.setOnInfoWindowClickListener(new OnInfoWindowClickListener() { @Override public void onInfoWindowClick(final Marker marker) { //tvLocInfo.setText("Info Window Selected"); if (marker.getTitle().equals("Ranch Area") || marker.getTitle().equals("Sherwood Court") || marker.getTitle().equals("Tripolee") || marker.getTitle().equals("The Observatory") || marker.getTitle().equals("The Hangar") || marker.getTitle().equals("Jubilee") || marker.getTitle().equals("Forest Stage")) { AlertDialog.Builder infowindowBuilderGeofence = new AlertDialog.Builder(MapPageActivity.this); infowindowBuilderGeofence.setTitle(R.string.infowindow_geofence_click_options).setItems( R.array.infowindow_geofence_choices_array, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: //tvLocInfo.setText("Favorite Stage Selected"); ParseInstallation installationFavorite = ParseInstallation .getCurrentInstallation(); ParsePush push = new ParsePush(); if (marker.getTitle().equals("Ranch Area")) { installationFavorite.put("RanchAreaFavorited", true); push.subscribeInBackground("RanchArea"); installationFavorite.saveInBackground(); } else if (marker.getTitle().equals("Sherwood Court")) { installationFavorite.put("SherwoodCourtFavorited", true); push.subscribeInBackground("SherwoodCourt"); installationFavorite.saveInBackground(); } else if (marker.getTitle().equals("Tripolee")) { installationFavorite.put("TripoleeFavorited", true); push.subscribeInBackground("Tripolee"); installationFavorite.saveInBackground(); } else if (marker.getTitle().equals("The Hangar")) { installationFavorite.put("TheHangarFavorited", true); push.subscribeInBackground("TheHanagar"); installationFavorite.saveInBackground(); } else if (marker.getTitle().equals("Jubilee")) { installationFavorite.put("JubileeFavorited", true); push.subscribeInBackground("Jubilee"); installationFavorite.saveInBackground(); } else if (marker.getTitle().equals("Forest Stage")) { installationFavorite.put("ForestStageFavorited", true); push.subscribeInBackground("ForestStage"); installationFavorite.saveInBackground(); } else if (marker.getTitle().equals("The Observatory")) { installationFavorite.put("TheObservatoryFavorited", true); push.subscribeInBackground("TheObservatory"); installationFavorite.saveInBackground(); } break; case 1: //tvLocInfo.setText("Unfavorite Stage Selected"); ParseInstallation installationUnfavorite = ParseInstallation .getCurrentInstallation(); ParsePush pushRemove = new ParsePush(); if (marker.getTitle().equals("Ranch Area")) { installationUnfavorite.put("RanchAreaFavorited", false); pushRemove.unsubscribeInBackground("RanchArea"); installationUnfavorite.saveInBackground(); } else if (marker.getTitle().equals("Sherwood Court")) { installationUnfavorite.put("SherwoodCourtFavorited", false); pushRemove.unsubscribeInBackground("SherwoodCourt"); installationUnfavorite.saveInBackground(); } else if (marker.getTitle().equals("Tripolee")) { installationUnfavorite.put("TripoleeFavorited", false); pushRemove.unsubscribeInBackground("Tripolee"); installationUnfavorite.saveInBackground(); } else if (marker.getTitle().equals("The Hangar")) { installationUnfavorite.put("TheHangar", false); pushRemove.unsubscribeInBackground("TheHanagar"); installationUnfavorite.saveInBackground(); } else if (marker.getTitle().equals("Jubilee")) { installationUnfavorite.put("JubileeFavorited", false); pushRemove.unsubscribeInBackground("Jubilee"); installationUnfavorite.saveInBackground(); } else if (marker.getTitle().equals("Forest Stage")) { installationUnfavorite.put("ForestStageFavorited", false); pushRemove.unsubscribeInBackground("ForestStage"); installationUnfavorite.saveInBackground(); } else if (marker.getTitle().equals("The Observatory")) { installationUnfavorite.put("TheObservatoryFavorited", false); pushRemove.unsubscribeInBackground("TheObservatory"); installationUnfavorite.saveInBackground(); } break; } } } ); infowindowBuilderGeofence.show(); } else { AlertDialog.Builder infowindowBuilderNoGeofence = new AlertDialog.Builder(MapPageActivity.this); infowindowBuilderNoGeofence.setTitle(R.string.infowindow_nogeofence_click_options).setItems( R.array.infowindow_nogeofence_choices_array, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: AlertDialog.Builder deleteConfirmation = new AlertDialog.Builder( MapPageActivity.this); deleteConfirmation.setTitle("Warning"); deleteConfirmation .setMessage("Are you sure you want to delete this marker?"); deleteConfirmation.setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { ParseGeoPoint geoPoint = new ParseGeoPoint( marker.getPosition().latitude, marker.getPosition().longitude); currentMarkerTitle = marker.getTitle(); ParseQuery<ParseObject> query = ParseQuery .getQuery("MapMarkers"); query.whereEqualTo("Title", currentMarkerTitle); query.getFirstInBackground(new GetCallback<ParseObject>() { @Override public void done(ParseObject object, ParseException e) { try { for (int i = 0; i < combinedArray.size(); i++) { if (combinedArray.get(i).getIdentification() .equals(object .getString("GeofenceID"))) { combinedArray.get(i).getCircle() .setRadius(0); combinedArray.get(i).getCircle() .remove(); combinedArray.get(i).getMarker() .remove(); combinedArray.remove(i); object.delete(); } } } catch (ParseException e1) { e1.printStackTrace(); } object.saveInBackground(); } }); } }); deleteConfirmation.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); deleteConfirmation.show(); break; case 1: //tvLocInfo.setText("Change title selected"); AlertDialog.Builder changeTitleInput = new AlertDialog.Builder( MapPageActivity.this); changeTitleInput.setTitle("Enter new Title: "); final EditText changeInput = new EditText(MapPageActivity.this); changeInput.setInputType(InputType.TYPE_CLASS_TEXT); changeTitleInput.setView(changeInput); changeTitleInput.setPositiveButton("Ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (changeInput.getText().toString().matches("")) { Toast.makeText(getApplicationContext(), "No Input Entered!", Toast.LENGTH_SHORT).show(); } else { ParseQuery<ParseObject> query = ParseQuery .getQuery("MapMarkers"); query.findInBackground(new FindCallback<ParseObject>() { @Override public void done(List<ParseObject> objects, ParseException e) { if (e == null) { for (int i = 0; i < objects.size(); i++) { if (objects.get(i).getString("Title") .equals(marker.getTitle())) { objects.get(i) .put("Title", changeInput .getText() .toString()); objects.get(i).saveInBackground(); } } } else { Toast.makeText(getApplicationContext(), "Error!", Toast.LENGTH_SHORT) .show(); } } }); for (int i = 0; i < combinedArray.size(); i++) { if (combinedArray.get(i).getIdentification() .equals(marker.getId())) { combinedArray.get(i).getMarker().setTitle( changeInput.getText().toString()); } } } } }); changeTitleInput.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); changeTitleInput.show(); break; } } } ); infowindowBuilderNoGeofence.show(); } } }); focusCamera(); buildGoogleApiClient(); }
From source file:com.facebook.react.views.textinput.ReactTextInputManager.java
@ReactProp(name = "keyboardType") public void setKeyboardType(ReactEditText view, @Nullable String keyboardType) { int flagsToSet = InputType.TYPE_CLASS_TEXT; if (KEYBOARD_TYPE_NUMERIC.equalsIgnoreCase(keyboardType)) { flagsToSet = INPUT_TYPE_KEYBOARD_NUMBERED; } else if (KEYBOARD_TYPE_EMAIL_ADDRESS.equalsIgnoreCase(keyboardType)) { flagsToSet = InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_CLASS_TEXT; } else if (KEYBOARD_TYPE_PHONE_PAD.equalsIgnoreCase(keyboardType)) { flagsToSet = InputType.TYPE_CLASS_PHONE; }//from w w w . jav a 2 s.co m updateStagedInputTypeFlag(view, INPUT_TYPE_KEYBOARD_NUMBERED | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS | InputType.TYPE_CLASS_TEXT, flagsToSet); checkPasswordType(view); }
From source file:com.xrmaddness.offthegrid.ListActivity.java
void group_name_dialog(final contact c) { if (!c.address_get().equals(pgp.my_user_id)) { Log.d("set_name_dialog", "not my group"); return;/*w w w .ja va2 s . c o m*/ } AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.setTitle(R.string.action_group_name); alert.setMessage(R.string.dialog_group_name); // Set an EditText view to get user input final EditText input = new EditText(this); input.setInputType(InputType.TYPE_CLASS_TEXT); alert.setView(input); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { String value = input.getText().toString(); c.name_set(value); group_update(c); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { } }); alert.show(); }