Pass data from RecyclerView Adapter to Parent Fragment
<p>I have a screen with a EditText to find content and a RecyclerView.</p>

<p>The EditText is to find in my web server</p>

<p>The RecyclerView shows most popular tags used</p>

<p>So, What I want to do is, when the user click any of the elements of the RecyclerView List 
that value selected is passed to editText.</p>

<p>I have a fragment which inflate the file which show all the stuff:</p>

<p><strong>tags_list.xml</strong></p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;FrameLayout 
    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"
    tools:context="org............BuscarFragment"&gt;   
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"&gt;

    &lt;EditText xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/inputSearch"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:drawableLeft="@android:drawable/ic_menu_search"
        android:hint="@string/busqueda"
        android:inputType="textVisiblePassword"
        android:lines="1"
        android:singleLine="true" /&gt;

    &lt;TextView
        android:id="@+id/buscar_msg"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/inputSearch" /&gt;


    &lt;TextView
        android:id="@+id/etiquetas_populares"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/buscar_msg"
        android:layout_marginLeft="16dp"
        android:text="@string/etiquetas_populares"/&gt;

    &lt;android.support.v7.widget.RecyclerView       xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/tags_list"
        android:name="org............TagsFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/etiquetas_populares"
        android:layout_marginLeft="16dp"
        android:layout_marginRight="16dp"
        app:layoutManager="LinearLayoutManager"
        tools:context="org...........activities.TagsActivity"
        tools:listitem="@layout/tags_list_content" /&gt;

&lt;/RelativeLayout&gt;

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

<p>In <strong>TagsFragment.java</strong> I have this method:</p>

<pre><code> @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        view = inflater.inflate(R.layout.tags_list, container, false);

        //RecyclerView Section
        mRecyclerView = (RecyclerView) view.findViewById(R.id.tags_list);
        mBuscarTagsAdapter = new BuscarTagsAdapter(getActivity(), tagMoreUsedRecyclerViewList);

        mRecyclerView.setAdapter(mBuscarTagsAdapter);


        addKeyListener();
        return view;
    }
</code></pre>

<p>Finally in my Adapter.</p>

<p>BuscarTagsAdapter.java</p>

<pre><code> @Override
    public void onBindViewHolder(final BuscarTagsViewHolder holder, int position) {


        final int posicion = position;


        //onClick for the list
        holder.mView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                //When the user click I want to pass this value to my EditText, but
                //I don't see how to do it from this Adapter

                Toast.makeText(context, tags.get(posicion).getTagName(), Toast.LENGTH_SHORT).show();

            }
        });
    }
</code></pre>

<p>Any idea?
Thanks</p>

<p><strong>UPDATED and SOLVED:</strong></p>

<p>Hi, @Brian Nam, thanks for help.</p>

<p>Made some changes.
First in Constructor as you suggested:</p>

<pre><code>    public BuscarTagsAdapter(Context context, List&lt;TagMoreUsedRecyclerView&gt; items, TagsListInterface tagsListInterface) {

            this.context = context;
            this.tags = items;
            this.tagsListInterface = tagsListInterface;

}
</code></pre>

<p>but tagsListInterface is not initialized properly in TagsFragment, 
so I added this in onCreate method:</p>

<pre><code> tagsListInterface = new TagsListInterface() {
            @Override
            public void onTagClicked(String tagName, int posicion) {
                EditText editText = (EditText) view.findViewById(R.id.inputSearch);
                editText.setText(tagName);
            }
        };
</code></pre>

<p>Finally in onClick for the RecyclerView:</p>

<p><strong>BuscarTagsAdapter.java</strong></p>

<pre><code> @Override
    public void onBindViewHolder(final BuscarTagsViewHolder holder, int position) {

        final int posicion = position;
        holder.mView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                Toast.makeText(context, tags.get(posicion).getTagName(), Toast.LENGTH_SHORT).show();
                tagsListInterface.onTagClicked(tags.get(posicion).getTagName(), posicion);


            }
        });
    }
</code></pre>