Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8499541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:41:46+00:00 2026-06-11T00:41:46+00:00

Im a beginner in android and need your advice: 1. The app is about

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:41:48+00:00Added an answer on June 11, 2026 at 12:41 am

    As the others have said the function to change the input type would be the setInputType function, how you could use it would be a couple of ways.

    1. Create a button listener from the code.

      OR use the onClick option in your element. <– How I would do it personally and shown below

    I.E.

    `<RadioButton android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:onClick="setInputTypeToSMS"
             android:text="SMS">`
    `<RadioButton android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:onClick="setInputTypeToEmail"
             android:text="EMAIL">`
    

    then in your main activity

    public class SomeActivity extends Activity{
        private EditText editText;
        public void onCreate(Bundle savedInstanceState) 
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            editText = (EditText)findViewById(R.id.editText);
    
        }
        public void setInputTypeToEmail(View view)
        {
           editText.setInputType(InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
        }
        public void setInputTypeToSMS(View view)
        {
           editText.setInputType(InputType.TYPE_CLASS_PHONE);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

everyone, I am a beginner of developing android app, currently I need to write
I am a beginner of Android and i need a bit hints and help.
I am a beginner to android and have designed a login GUI for app
I am beginner to programming for android. First of all i need that my
I'm a beginner to android. I need to know is there any intent to
I am beginner in android application development. If i am using n number of
I am pure beginner to [android-eclipse],here i need to consume web services from the
I am a beginner in android programming. My Graduate project is about tracking a
I'm beginner in Java Android developing. I'm using Eclipse SDK 3.6.1 version. I'm trying
I am a beginner in Android development, and i need to know the following;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.