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

  • What is the alternative of SlidingDrawer which is deprecated? For sliding up from bottom
  • Gallery space at beginning and end
  • no peer certificate
  • onActivityResult gets called when Activity starts, not when its finished
  • Share memory between two processes in Dalvik
  • Google Mobile Vision Text API Example
  • Related posts:

    Programmatically collapse or expand CollapsingToolbarLayout
    Adding a day to a Calendar in Android fails on 31st
    Mediaplayer error (-38,0) , stop called in state 4
    Android RecyclerView + CursorLoader + ContentProvider + “Load More”
    Native USB Debugging on Chrome 32 doesn't detect device
    Clarification regarding Android “Attribute elevation is only used in API level 21 and high...
  • How to detect orientation change in layout in Android?
  • cordova/phonegap does not make android directory
  • ViewFlipper vs Fragments
  • How can I display a list view in an Android Alert Dialog?
  • Require a password to uninstall/remove application
  • Use google map on any devices. (without google play )
  • 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.