how to set color the selected Item of Recycler View?
<p>I have a <code>RecyclerView</code> with the <code>TextView</code> loaded from array <code>MyData</code>.  Actually what I need is when I click any item in <code>RecyclerView</code> that Item must get color and when I click another item I want that the first one become normal.  </p>

<pre><code>    private static class MyOnClickListener implements View.OnClickListener {

    private final Context context;
    String PersonGenerated;

    private MyOnClickListener(Context context) {
        this.context = context;
    }

    @Override
    public void onClick(View v) {
        // removeItem(v);
        int selectedItemPosition = recyclerView.getChildPosition(v);
        RecyclerView.ViewHolder viewHolder
                = recyclerView.findViewHolderForPosition(selectedItemPosition);
        TextView textViewName
                = (TextView) viewHolder.itemView.findViewById(R.id.textview_name);
        String selectedName = (String) textViewName.getText();

  data = new ArrayList&lt;DataModel&gt;();
    for (int i = 0; i &lt; MyData.nameArray.length; i++) {
        data.add(new DataModel(
                MyData.id_[i],
                MyData.nameArray[i]

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

<p>This is my Adapter Class:</p>

<pre><code>public class CustomAdapter extends RecyclerView.Adapter&lt;CustomAdapter.MyViewHolder&gt; {

private ArrayList&lt;DataModel&gt; dataSet;



public CustomAdapter(ArrayList&lt;DataModel&gt; data) {
    this.dataSet = data;
}

@Override
public MyViewHolder onCreateViewHolder(ViewGroup parent,
                                       int viewType) {
    View view = LayoutInflater.from(parent.getContext())
            .inflate(R.layout.adapter_persons, parent, false);

    view.setOnClickListener(Persons.myOnClickListener);

    MyViewHolder myViewHolder = new MyViewHolder(view);
    return myViewHolder;
}

@Override
public void onBindViewHolder(final MyViewHolder holder, final int listPosition) {

    holder.textViewName.setText(dataSet.get(listPosition).getName());

}


@Override
public int getItemCount() {
    return dataSet.size();


}

public void animate(RecyclerView.ViewHolder viewHolder) {
    final Animation animAnticipateOvershoot = AnimationUtils.loadAnimation(context, R.anim.anticipateovershoot_interpolator);
    viewHolder.itemView.setAnimation(animAnticipateOvershoot);
}

public static class MyViewHolder extends RecyclerView.ViewHolder {

    TextView textViewName;

    public MyViewHolder(View itemView) {
        super(itemView);
        this.textViewName = (TextView) itemView.findViewById(R.id.textview_name);
    }
}
}
</code></pre>

<p>This is my Array Class:</p>

<pre><code>public class MyData {

    static String[] nameArray = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30"};
    static Integer[] id_ = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29};
}
</code></pre>

<p>Adapter Layout</p>

<pre><code>&lt;LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="@drawable/select_row"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"&gt;


    &lt;TextView
        android:layout_weight="1"
        android:layout_width="50dp"
        android:layout_height="50dp"
        style="@style/custom_text_oval"
        android:text="1"
        android:textColor="#8F8F8F"
        android:id="@+id/textview_name" /&gt;
</code></pre>

<p></p>

<p>Recyclerview layout</p>

<pre><code>  &lt;LinearLayout
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/linearLayout3"
            android:layout_gravity="center_horizontal"&gt;


            &lt;android.support.v7.widget.RecyclerView
                android:id="@+id/my_recycler_view"
                android:scrollbars="vertical"
                android:layout_width="match_parent"
                android:layout_height="match_parent" /&gt;


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