how to change the text color of selected item inside recycler view
<p>I have a list of items using recycler view. I need to change the text color (textview color) of item when it is selected to indicate that the particular item is selected. Below is my adapter code. Kindly suggest me how to achieve this.</p>

<pre><code>@Override
public GridView_Holder onCreateViewHolder(ViewGroup viewGroup, int viewType) {

    View itemView = LayoutInflater.from(viewGroup.getContext())
            .inflate(R.layout.grid_customview, viewGroup, false);

    gridHolder = new GridView_Holder(itemView);
    ColorDrawable colorDrawableSelected = new ColorDrawable(context.getResources().getColor(R.color.borderColor));
    // create StateListDrawable object and define its states
    StateListDrawable stateListDrawable = new StateListDrawable();
    stateListDrawable.addState(new int[]{android.R.attr.state_selected}, colorDrawableSelected);
    stateListDrawable.addState(StateSet.WILD_CARD, null);
    // set the StateListDrawable as background of the item view
    if (android.os.Build.VERSION.SDK_INT &lt; android.os.Build.VERSION_CODES.JELLY_BEAN) {
        itemView.setBackgroundDrawable(stateListDrawable);
    }
    else {
        itemView.setBackground(stateListDrawable);
    }

    return  new GridView_Holder(itemView);
}


@Override
public void onBindViewHolder(GridView_Holder holder, int position) {

    model = arrayList.get(position);
    gridHolder = (GridView_Holder) holder;// Holder
    gridHolder.tvTitle.setText(model.getVideoName());    //set title                        

    Glide.with(context).load(model.getVideoImageThumbnail())
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(gridHolder.imageView);
}


@Override
public void onAttachedToRecyclerView(final RecyclerView recyclerView) {
    super.onAttachedToRecyclerView(recyclerView);
    recyclerView.setOnKeyListener(new View.OnKeyListener() {
        @Override
        public boolean onKey(View v, int keyCode, KeyEvent event) {

            GridLayoutManager lm = ((GridLayoutManager) recyclerView.getLayoutManager());
            if (event.getAction() == KeyEvent.ACTION_DOWN) {
                if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN)
                {
                    if(mCurrentSelectedPosition + 6 &lt; getItemCount())
                    {
                        gridHolder = (GridView_Holder) mRecyclerView.findViewHolderForPosition(mCurrentSelectedPosition);
                        gridHolder.itemView.setSelected(false);
                        notifyItemChanged(mCurrentSelectedPosition);
                        int lastItem = lm.findLastCompletelyVisibleItemPosition();
                        if((mCurrentSelectedPosition+6) &gt; lastItem)
                        {
                        recyclerView.smoothScrollToPosition(mCurrentSelectedPosition+6);
                        }
                        else
                        {
                            gridHolder = (GridView_Holder) mRecyclerView.findViewHolderForPosition(mCurrentSelectedPosition+6);
                            gridHolder.itemView.setSelected(true);
                        }

                        mCurrentSelectedPosition += 6 ;
                    }
                    return true;
                }
                else if (keyCode == KeyEvent.KEYCODE_DPAD_UP) 
                {
                }

                else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) {
                    if(mCurrentSelectedPosition + 1 &lt; getItemCount())
                    {
                        gridHolder = (GridView_Holder) mRecyclerView.findViewHolderForPosition(mCurrentSelectedPosition);
                        gridHolder.itemView.setSelected(false);
                        notifyItemChanged(mCurrentSelectedPosition);
                        int lastItem = lm.findLastCompletelyVisibleItemPosition();
                        if((mCurrentSelectedPosition+1) &gt; lastItem)
                        {
                                                        recyclerView.smoothScrollToPosition(mCurrentSelectedPosition+1);
                        }
                        else
                        {
                            gridHolder = (GridView_Holder) mRecyclerView.findViewHolderForPosition(mCurrentSelectedPosition+1);
                            gridHolder.itemView.setSelected(true);
                        }
                        mCurrentSelectedPosition += 1 ;
                    }
                    return true;
                }
                return false;
        }
    });
}
</code></pre>