// Path: SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/MyAdapter.java
// public class MyAdapter extends RecyclerView.Adapter<MyAdapter.CardHolder> {
//     Context context;
//     List<Data> cardArrayList;
// 
//     public MyAdapter(Context context, List<Data> cardArrayList) {
//         this.context = context;
//         this.cardArrayList = cardArrayList;
// 
//     }
// 
//     @Override
//     public CardHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//         return new CardHolder(LayoutInflater.from(context).inflate(R.layout.single_row,parent,false));
//     }
// 
//     @Override
//     public void onBindViewHolder(CardHolder holder, int position) {
//         final Data card=cardArrayList.get(position);
//         holder.namedisp.setText(card.getName());
//         holder.datedisp.setText(card.getDoj());
//         holder.perdisp.setText((String.valueOf(card.getPercentage())));
//     }
//     @Override
//     public int getItemCount() {
//         return cardArrayList.size();
//     }
// 
// 
//     class CardHolder extends RecyclerView.ViewHolder{
//         CardView cardView;
// 
//         TextView namedisp,datedisp,perdisp;
//         public CardHolder(View itemView) {
//             super(itemView);
//             cardView=itemView.findViewById(R.id.cardView);
//             namedisp=itemView.findViewById(R.id.namedisp);
//             datedisp=itemView.findViewById(R.id.datedisp);
//             perdisp=itemView.findViewById(R.id.perdisp);
//         }
//     }
// }


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.android.sqlitedemo.MyAdapter;
import com.example.android.sqlitedemo.R;
import java.util.List;
package com.example.android.sqlitedemo.Classes;




/**
 * Created by Nishita Aggarwal on 25-11-2017.
 */

public class DisplayFragment extends Fragment {

    private RecyclerView mRecyclerView;
    private RecyclerView.Adapter mAdapter;
    private RecyclerView.LayoutManager mLayoutManager;
    List<Data> dataList;

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

        View v=inflater.inflate(R.layout.display_fragment,container,false);
        dataList=getArguments().getParcelableArrayList("data");

        mRecyclerView =  v.findViewById(R.id.my_recycler_view);

        // use this setting to improve performance if you know that changes
        // in content do not change the layout size of the RecyclerView
        mRecyclerView.setHasFixedSize(true);

        // use a linear layout manager
        mLayoutManager = new LinearLayoutManager(this.getContext());
        mRecyclerView.setLayoutManager(mLayoutManager);

        // specify an adapter (see also next example)
// Path: SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/MyAdapter.java
// public class MyAdapter extends RecyclerView.Adapter<MyAdapter.CardHolder> {
//     Context context;
//     List<Data> cardArrayList;
// 
//     public MyAdapter(Context context, List<Data> cardArrayList) {
//         this.context = context;
//         this.cardArrayList = cardArrayList;
// 
//     }
// 
//     @Override
//     public CardHolder onCreateViewHolder(ViewGroup parent, int viewType) {
//         return new CardHolder(LayoutInflater.from(context).inflate(R.layout.single_row,parent,false));
//     }
// 
//     @Override
//     public void onBindViewHolder(CardHolder holder, int position) {
//         final Data card=cardArrayList.get(position);
//         holder.namedisp.setText(card.getName());
//         holder.datedisp.setText(card.getDoj());
//         holder.perdisp.setText((String.valueOf(card.getPercentage())));
//     }
//     @Override
//     public int getItemCount() {
//         return cardArrayList.size();
//     }
// 
// 
//     class CardHolder extends RecyclerView.ViewHolder{
//         CardView cardView;
// 
//         TextView namedisp,datedisp,perdisp;
//         public CardHolder(View itemView) {
//             super(itemView);
//             cardView=itemView.findViewById(R.id.cardView);
//             namedisp=itemView.findViewById(R.id.namedisp);
//             datedisp=itemView.findViewById(R.id.datedisp);
//             perdisp=itemView.findViewById(R.id.perdisp);
//         }
//     }
// }


// Path: SQLiteDemo/app/src/main/java/com/example/android/sqlitedemo/Classes/DisplayFragment.java
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.example.android.sqlitedemo.MyAdapter;
import com.example.android.sqlitedemo.R;
import java.util.List;

package com.example.android.sqlitedemo.Classes;




/**
 * Created by Nishita Aggarwal on 25-11-2017.
 */

public class DisplayFragment extends Fragment {

    private RecyclerView mRecyclerView;
    private RecyclerView.Adapter mAdapter;
    private RecyclerView.LayoutManager mLayoutManager;
    List<Data> dataList;

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

        View v=inflater.inflate(R.layout.display_fragment,container,false);
        dataList=getArguments().getParcelableArrayList("data");

        mRecyclerView =  v.findViewById(R.id.my_recycler_view);

        // use this setting to improve performance if you know that changes
        // in content do not change the layout size of the RecyclerView
        mRecyclerView.setHasFixedSize(true);

        // use a linear layout manager
        mLayoutManager = new LinearLayoutManager(this.getContext());
        mRecyclerView.setLayoutManager(mLayoutManager);

        // specify an adapter (see also next example)
        mAdapter = new MyAdapter(this.getContext(),dataList);