I would put in this code a control on EditText so that it only accepts hexadecimal numbers. How do I go about doing this?
bin = (EditText)findViewById(R.id.editText02);
hex = (EditText)findViewById(R.id.editText3);
dec = (EditText)findViewById(R.id.editText1);
oct = (EditText)findViewById(R.id.editText04);
In your android layout XML file add the following attributes to EditText:
<EditText
android:digits="0123456789ABCDEF"
android:inputType="textCapCharacters"
/>
The first attribute allows only input with these numerals. Any other input is rejected and not displayed. The second attribute capitalizes characters.
credit goes to this blog post: http://mobile.antonio081014.com/2012/04/how-to-let-input-of-edittext-only-be.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With