How to set the value in EditText field?

I have three EditText, I want to concatinate the strings present in the first two EditText fields,and display in the third EditText field.After entering the string at 2nd field,it
automatically concatinate and set in the third EditText.

EditText text1 = (EditText) findViewById(;

EditText text2 = (EditText) findViewById(;
mtext2 = text2.getText.toString();

Edit text3 = (EditText) findViewById(;
text3 = setText(mtext3.toString());

I wrote the above code.But I result is not shomn in the third EditText.
Please give the solution, that I implement in my program

  • Cannot read property 'getPicture' of undefined - ionic camera
  • Android resource selection layout- and values- inconsistencies
  • Google Plus tile animation
  • Detect if Flash is installed on Android and embed a Flash video in an Activity
  • React-native android ignores navigator.geolocation.getCurrentPosition
  • Material Design Typography - Headlines, Titles, Spacing, Text Appearance
  • How do I refresh the Android emulator network connection after the host switches network?
  • Full text search example in Android
  • How to add click action for the ImageSpan
  • Android, Drawable.createFromStream(is, srcname): what's the 2nd parameter meaning?
  • Popup DatePicker for EditText
  • How to set an image to imageView using filepath in android
  • 4 Solutions collect form web for “How to set the value in EditText field?”

    This should work. Make sure you do not edit text2 in the TextChanged listener because then afterTextChanged would get called again.

    final EditText text1 = (EditText) findViewById(;
    final EditText text2 = (EditText) findViewById(;
    final EditText text3 = (EditText) findViewById(;
    text2.addTextChangedListener(new TextWatcher() {
        void afterTextChanged(Editable s) {
            text3.setText(text1.getText().toString() + text2.getText().toString());

    If you want to detect when your two EditText fields change, you’re going to need to use addTextChangedListener() on each of them. The following can go in your onCreate() method:

    final EditText text1 = (EditText) findViewById(;
    final EditText text2 = (EditText) findViewById(;
    final EditText text3 = (EditText) findViewById(;
    TextWatcher watcher = new TextWatcher() {
        void afterTextChanged(Editable s) {
            text3.setText(text1.getText() + text2.getText());
    package com.tiru;
    import android.os.Bundle;
    import android.widget.EditText;
    public class SetEditText extends Activity {
        private String mtext1 = null;
        private String mtext2 = null;
        private String mtext3 = null;
        public void onCreate(Bundle savedInstanceState) {
            EditText text1 = (EditText) findViewById(;
            EditText text2 = (EditText) findViewById(;
            mtext1 = text1.getText();
            mtext2 = text2.getText();
            mtext3 = mtext1 + mtext2;
            EditText text3 = (EditText) findViewById(;
    EditText inputWeight,inputHeight,outputResult;
    Button calculate;
    float num1,num2,out;
    protected void onCreate(Bundle savedInstanceState) {
        inputWeight = (EditText) findViewById(;
        inputHeight = (EditText) findViewById(;
        outputResult = (EditText) findViewById(;
        calculate = (Button) findViewById(;
        calculate.setOnClickListener(new View.OnClickListener()
            public void onClick(View v)
                num1 = Float.parseFloat(inputWeight.getText().toString());
                num2 = Float.parseFloat(inputHeight.getText().toString());
                calculate.setText(" "+out);
    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.