How Allow A Specific Character In Android Numerical Keyboard?
I'm developing an science app, and I have an EditText in wich I must enter an input numeric value, so the inputType is 'number|numberSigned|numberDecimal', but the problem is when
Solution 1:
There is no way to show the numerical keyboard with an extra letter E
on it, two ways around this are either make a button that inputs E
to your edittext or to use the android:digits
attribute like such:
android:digits="1234567890E."
Where all the characters in the brackets are the ones that you want the user to be able to input
To make do it using a button, in its onClickListener
you just need to put the following code
edittext.setText(edittext.getText().toString() + "E"
In the other hand if you want to insert the character in the position of the cursor then you should try this (taken from here)
intstart=edittext.getSelectionStart();
String s = "E";
edittext.getText().insert(start, s);
Post a Comment for "How Allow A Specific Character In Android Numerical Keyboard?"