Code example for DigitsKeyListener

0
		AlertDialog builder = new AlertDialog.Builder(this).create();
		final EditText input = new EditText(this);
		input.setText(tmpId);
 
		// keyListener for phone number to demand numeric data 
		DigitsKeyListener MyDigitKeyListener = new DigitsKeyListener(true, false); // first true : is signed, second one : is decimal
		input.setKeyListener( MyDigitKeyListener );
 
		input.setHint("Your phone number");
		builder.setView(input);
		builder.setCancelable(false);
		builder.setButton("OK", new OnClickListener() {			
			@Override 
			public void onClick(DialogInterface dialog, int which) {
				String value = input.getText().toString();
				if (value.length()==0)
					requestPhoneFromUser(); 
				else{ 
					value = com.tools.Tools.keepOnlyNumerics(com.tools.Tools.formatPhoneNumber(value));
					((BeerWithMeApp)getApplicationContext()).setUserID(value);
					getSecret();