List of usage examples for android.text.method DigitsKeyListener DigitsKeyListener
@Deprecated
public DigitsKeyListener()
From source file:Main.java
public static EditText applyNumericFilter(EditText field) { field.setKeyListener(new DigitsKeyListener()); return field; }
From source file:com.example.skode6.scanenvy.MainActivity.java
private AlertDialog enterDialog(final EditText edit) { AlertDialog.Builder dialog = new AlertDialog.Builder(this); edit.setKeyListener(new DigitsKeyListener()); final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(edit, InputMethodManager.SHOW_IMPLICIT); //edit.setFocusableInTouchMode(true); edit.setFocusable(true);// ww w . j a va 2 s.co m //edit.setOnClickListener(clickText()); //edit.requestFocusFromTouch(); edit.requestFocus(); dialog.setView(edit); dialog.setCancelable(true); dialog.setTitle("Enter UPC"); dialog.setPositiveButton("Submit", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String upc = edit.getText().toString(); try { Product p = run.lookUp(upc); adapter.add(p); //run.addProduct(p); } catch (IOException e) { Toast error = Toast.makeText(getApplicationContext(), "Couldn't find" + upc, Toast.LENGTH_LONG); error.show(); } } }); dialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); return dialog.create(); }