title: Pass Edit Text Content To RecyclerView in Next Activity
body: <p>I am passing the <code>EditText</code> values from one activity to another Activity that contains <code>RecyclerView</code>. But i got a problem which remains Unsolvable for me.</p>
  
  <p>My <code>main.xml</code> contains <code>Edit text</code> field and add <code>Button</code>. On click of add <code>Button</code> the <code>Edit Text</code> value should pass to <code>RecyclerView</code> in next XML.</p>
  
  <p>This is my Main Activity:</p>
  
  <pre><code>import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  import android.os.Bundle;
  import android.support.v7.app.ActionBarActivity;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.view.View;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.Toast;
  
   public class MainActivity extends ActionBarActivity {
  
  private RecyclerView myRecyclerView;
  private LinearLayoutManager linearLayoutManager;
  private RecyclerViewAdapter myRecyclerViewAdapter;
  
  EditText nameField;
  Button btnAdd;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      myRecyclerView = (RecyclerView) findViewById(R.id.myrecyclerview);
  
      nameField = (EditText) findViewById(R.id.namefield);
      btnAdd = (Button) findViewById(R.id.addbutton);
      btnAdd.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              /*String newName = nameField.getText().toString();*/
              Intent i = new Intent(getApplicationContext(), ListFromMain.class);
              startActivity(i);
              /*myRecyclerViewAdapter.add(0,newName);
              Toast.makeText(MainActivity
                      .this,"You added" +newName.toUpperCase()+ "in your view",Toast.LENGTH_LONG).show();*/
  
          }
      });
  }
  </code></pre>
  
  <p>}</p>
  
  <p>My Recycler Adapter</p>
  
  <pre><code>public class RecyclerViewAdapter extends RecyclerView.Adapter&lt;RecyclerViewAdapter.ItemHolder&gt; {
  
  private List&lt;String&gt; itemsName;
  private OnItemClickListener onItemClickListener;
  private LayoutInflater layoutInflater;
  
  public RecyclerViewAdapter(Context context){
      layoutInflater = LayoutInflater.from(context);
      itemsName = new ArrayList&lt;String&gt;();
  }
  
  @Override
  public RecyclerViewAdapter.ItemHolder onCreateViewHolder(ViewGroup parent, int viewType) {
      View itemView = layoutInflater.inflate(R.layout.text_view,parent, false);
      return new ItemHolder(itemView, this);
  }
  
  @Override
  public void onBindViewHolder(RecyclerViewAdapter.ItemHolder holder, int position) {
      holder.setItemName(itemsName.get(position));
  
  }
  
  @Override
  public int getItemCount() {
      return itemsName.size();
  }
  
  public void setOnItemClickListener(OnItemClickListener listener){
      onItemClickListener = listener;
  }
  
  public OnItemClickListener getOnItemClickListener(){
      return onItemClickListener;
  }
  
  public interface OnItemClickListener{
      public void onItemClick(ItemHolder item, int position);
  }
  
  public void add(int location, String iName){
      itemsName.add(location, iName);
      notifyItemInserted(location);
  }
  
  
  public static class ItemHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
  
      private RecyclerViewAdapter parent;
      TextView textItemName;
  
      public ItemHolder(View itemView, RecyclerViewAdapter parent) {
          super(itemView);
          itemView.setOnClickListener(this);
          this.parent = parent;
          textItemName = (TextView) itemView.findViewById(R.id.textview);
      }
  
      public void setItemName(CharSequence name){
          textItemName.setText(name);
      }
  
      public CharSequence getItemName(){
          return textItemName.getText();
      }
  
      @Override
      public void onClick(View v) {
          final OnItemClickListener listener = parent.getOnItemClickListener();
          if(listener != null){
              listener.onItemClick(this, getPosition());
          }
      }
  }}
  </code></pre>
  
  <p>ListActivity</p>
  
  <pre><code>public class ListFromMain extends ActionBarActivity implements RecyclerViewAdapter.OnItemClickListener{
  
  private RecyclerView myRecyclerView;
  private LinearLayoutManager linearLayoutManager;
  private RecyclerViewAdapter myRecyclerViewAdapter;
  @Override
  protected void onCreate( Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.reycler_list);
  
      RecyclerView recyclerView = (RecyclerView) findViewById(R.id.myrecyclerview);
  
      linearLayoutManager =
              new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
  
      myRecyclerViewAdapter = new RecyclerViewAdapter(this);
  
      myRecyclerView.setAdapter(myRecyclerViewAdapter);
      myRecyclerView.setLayoutManager(linearLayoutManager);
  
  
  }
  @Override
  public void onItemClick(RecyclerViewAdapter.ItemHolder item, int position) {
      Toast.makeText(this,
              "Remove " + position + " : " + item.getItemName(),
              Toast.LENGTH_SHORT).show();
  }}
  </code></pre>
  
  <p>Main.xml</p>
  
  <pre><code>&lt;LinearLayout 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"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  android:paddingBottom="@dimen/activity_vertical_margin"
  tools:context=".MainActivity"
  android:orientation="vertical"&gt;
  
  
  &lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical"&gt;
      &lt;EditText
          android:id="@+id/namefield"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"/&gt;
      &lt;Button
          android:id="@+id/addbutton"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:text="Add"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>Recycler_list.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"&gt;
  
  &lt;android.support.v7.widget.RecyclerView
      android:id="@+id/myrecyclerview"
      android:layout_width="match_parent"
      android:layout_height="match_parent"/&gt;
   &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>textview xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
   &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/textview"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>The edit text value from main should be displayed in recycler_list.</p>