Im a beginner in android and need your advice:
1. The app is about to send a message (sms or email) using two radio buttons (SMS or Email).
2. When initiating, the SMS radio button will be checked and the EditText for the contact/receiver is on android:inputType="phone"
3. If i click on the EMAIL radio button i would like the EditText to be changed to android:inputType="textEmailAddress"
how can i do this from the MainActivity.java?
You can do that by using this method :
et.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
Try this, it might help you
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
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