EditText editable but getText() return empty string
<p>I'm trying to make a simple messaging system in my app. The user type the message in an <code>EditText</code>at the bottom of the screen. Somehow, the <code>EditText</code>that's displayed on the screen isn't actually the one that I get using <code>findViewById()</code>. </p>

<p>I tried adding default value to the <code>EditText</code>in the xml and it works. But if I change the default text, the text on the screen changes but <code>editText.getText()</code>still returns the default value. <code>editText.setText()</code> doesn't change the text displayed on the screen but does change the actual value (<code>editText.getText()</code> returns the new text).</p>

<p>Here's my code:</p>

<p>fragment_message.xml</p>

<pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context="com.gloriovin.helpio.Views.MessageFragment"
    android:id="@+id/message_fragment"
    android:orientation="vertical"&gt;

    &lt;ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/sendMessageSection"
        android:id="@+id/listView"
        android:clipToPadding="false"
        android:divider="@color/Transparent"
        android:stackFromBottom="true"
        android:transcriptMode="alwaysScroll"&gt;&lt;/ListView&gt;

    &lt;RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:id="@+id/sendMessageSection"
        android:layout_alignParentBottom="true"
        android:background="@color/LightGrey"&gt;

        &lt;com.mikepenz.iconics.view.IconicsImageView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:id="@+id/sendButton"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:layout_marginRight="3dp"
            app:iiv_size="25dp"
            app:iiv_color="@color/DarkGrey"
            app:iiv_icon="gmd-send" /&gt;

        &lt;EditText
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/messageField"
            android:layout_toLeftOf="@id/sendButton"
            android:singleLine="true"
            android:text="kuda"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="3dp"
            android:gravity="bottom"/&gt;

    &lt;/RelativeLayout&gt;

&lt;/RelativeLayout&gt;
</code></pre>

<p>chatActivity.java</p>

<pre><code>import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import com.gloriovin.helpio.R;

public class ChatActivity extends AppCompatActivity {

    private Toolbar toolbar;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chat);
        toolbar = (Toolbar) findViewById(R.id.toolbar);
        toolbar.setTitle("Message");

        MessageFragment messageFragment = new MessageFragment();
    getSupportFragmentManager().beginTransaction().replace(R.id.fragment, messageFragment).    commit();

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_message, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }

}
</code></pre>

<p>messageFragment.java</p>

<pre><code>import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.design.widget.FloatingActionButton;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.ListView;

import com.gloriovin.helpio.Adapters.friendAdapters;
import com.gloriovin.helpio.Adapters.messageAdapters;
import com.gloriovin.helpio.Globals;
import com.gloriovin.helpio.HelpioApp;
import com.gloriovin.helpio.Models.Message;
import com.gloriovin.helpio.Models.MessageRoom;
import com.gloriovin.helpio.R;
import com.mikepenz.iconics.view.IconicsImageView;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.zip.Inflater;

import cz.msebera.android.httpclient.Header;
import io.paperdb.Paper;


public class MessageFragment extends Fragment {
    private Activity activity;
    private int mid;
    public MessageFragment() {
    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_message, container, false);

    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mid = getActivity().getIntent().getIntExtra("mid", -1);
        this.activity  = getActivity();
        Log.e("mid", String.valueOf(mid));
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);



        ListView listView = (ListView) getActivity().findViewById(R.id.listView);
        messageAdapters adapter = new messageAdapters(getActivity(), FAKECHAT);
        listView.setDivider(null);
        listView.setAdapter(adapter);


        IconicsImageView sendButton = (IconicsImageView) getActivity().findViewById(R.id.    sendButton);
        sendButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                EditText newMessage = (EditText) getActivity().findViewById(R.id.messageField);
                String msg = newMessage.getText().toString();
                Log.e("message is", "asd"+msg);
            }
        });
    }

    @Override
    public void onDetach() {
        super.onDetach();
    }
}
</code></pre>

<p>TLDR:
in <code>messageFragment.java</code>, the <code>EditText</code> value(.getText()) is different (empty string "") than what actually typed in the <code>EditText</code>. 
<code>setText()</code>doesn't change the appearance of the <code>EditText</code>but does change the result of <code>getText()</code></p>