How to create Fragment witch shows element clicked on RecyclerView? : I'm new at Android so maybe I'm just lack of understanding how things work. So what I have right now is RecyclerView of five elements. Each of them contains figure of different shape, different fruit name and different color bar. What I seek is to create Fragment which would show some background color, figure and fruit name inside that figure, depending on what Recyclerview element user clicks. How can I do that?

That's my **MyAdapter.java**
    
    public class MyAdapter extends RecyclerView.Adapter <MyAdapter.MyViewHolder> {


    Context context;
    ArrayList<Information> data;

    public MyAdapter(Context context, ArrayList<Information> data) {
        this.context = context;
        this.data = data;
    }

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

    @Override
    public void onBindViewHolder(final MyViewHolder holder, final int position) {
        holder.textView.setText(data.get(position).title);
        holder.relativeLayout.setBackground(context.getResources().getDrawable(data.get(position).shape));
        holder.textView2.setBackground(context.getResources().getDrawable(data.get(position).color));

    }

    @Override
    public int getItemCount() {
        return data.size();
    }
    class MyViewHolder extends RecyclerView.ViewHolder {

        TextView textView,textView2;
        RelativeLayout relativeLayout;

        public MyViewHolder(View itemView) {
            super(itemView);
            textView = (TextView) itemView.findViewById(R.id.txt_view);
            relativeLayout = (RelativeLayout) itemView.findViewById(R.id.img_view);
            textView2 = (TextView) itemView.findViewById(R.id.textView);

        }
    }
}

**MyActivity.java**

    public class MyActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my);
        RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
        MyAdapter adapter = new MyAdapter(this, Data.getData(this));
        recyclerView.setAdapter(adapter);
        recyclerView.setLayoutManager(new GridLayoutManager(this,1));


    }
}

**activity_my.xml**

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    >

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

    </android.support.v7.widget.RecyclerView>
    </android.support.design.widget.CoordinatorLayout>

and **fragment_layout.xml**

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragment_layout"
    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"
    >


    <RelativeLayout
        android:id="@+id/fragment_img"
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_gravity="center"
        android:rotation="180"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true">

        <TextView
            android:id="@+id/fragment_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:rotation="180"
            android:textSize="20sp"
            android:layout_centerVertical="true"
            android:layout_centerHorizontal="true" />
    </RelativeLayout>


    </RelativeLayout>
