I am passing the `EditText` values from one activity to another Activity that contains `RecyclerView`. But i got a problem which remains Unsolvable for me.

My `main.xml` contains `Edit text` field and add `Button`. On click of add `Button` the `Edit Text` value should pass to `RecyclerView` in next XML.

This is my Main Activity:

```
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();*/

        }
    });
}

```

}

My Recycler Adapter

```
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ItemHolder> {

private List<String> itemsName;
private OnItemClickListener onItemClickListener;
private LayoutInflater layoutInflater;

public RecyclerViewAdapter(Context context){
    layoutInflater = LayoutInflater.from(context);
    itemsName = new ArrayList<String>();
}

@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());
        }
    }
}}

```

ListActivity

```
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();
}}

```

Main.xml

```
<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">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">
    <EditText
        android:id="@+id/namefield"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>
    <Button
        android:id="@+id/addbutton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Add"/>
</LinearLayout>

```

Recycler\_list.xml

```
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.v7.widget.RecyclerView
    android:id="@+id/myrecyclerview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>
 </LinearLayout>

```

textview xml

```
<?xml version="1.0" encoding="utf-8"?>
 <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/textview"/>

```

The edit text value from main should be displayed in recycler\_list.