title: Display data from SQLite Database to Cardview
body: <p>I have implemented the CardView showing dummy cards. But I have to
  display data to this cards from SQLite database i.e., from each row to
  each card. Also I want to implement deletion of a particular row when delete button is pressed in the card. How can I do this?</p>
  
  <p>This is my card fragment code:</p>
  
  <pre><code>public class UserAppFragment extends Fragment {
  
  public UserAppFragment() {
      // Required empty public constructor
  }
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  }
  
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
  
      //using recycle view cutomizing card views
      RecyclerView recyclerView = (RecyclerView) inflater.inflate(
              R.layout.recycler_view, container, false);
      ContentAdapter adapter = new ContentAdapter();
      recyclerView.setAdapter(adapter);
      recyclerView.setHasFixedSize(true);
      recyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
  
      FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
      fab.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              // Click action
              Toast.makeText(getContext(),"FAB",Toast.LENGTH_SHORT).show();
              Intent intent = new Intent(getContext(), EventAdder.class);
              startActivity(intent);
          }
      });
  
      return recyclerView;
  }
  //view holder for cards data start
  public static class ViewHolder extends RecyclerView.ViewHolder {
      public ViewHolder(LayoutInflater inflater, ViewGroup parent) {
          super(inflater.inflate(R.layout.fragment_home_card_list, parent, false));
          itemView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Context context = v.getContext();
                  Intent intent = new Intent(context, EventAdder.class);
                  context.startActivity(intent);
              }
          });
  
  
          ImageButton shareImageButton =
                  (ImageButton) itemView.findViewById(R.id.share_button);
          shareImageButton.setOnClickListener(new View.OnClickListener(){
              @Override
              public void onClick(View v) {
                  Snackbar.make(v, "Added to Favorite",
                          Snackbar.LENGTH_LONG).show();
              }
          });
  
          ImageButton deleteImageButton = (ImageButton) itemView.findViewById(R.id.delete_button);
          deleteImageButton.setOnClickListener(new View.OnClickListener(){
              @Override
              public void onClick(View v) {
                  Snackbar.make(v, "Card deleted",
                          Snackbar.LENGTH_LONG).show();
              }
          });
  
      }
  } //view holder end
  
  // start recycleview.adapter wrapping viewholder created
  public static class ContentAdapter extends RecyclerView.Adapter&lt;ViewHolder&gt; {
      // Set numbers of List in RecyclerView.
      private static final int LENGTH = 15;
      public ContentAdapter(){
  
  
      }
  
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          return new ViewHolder(LayoutInflater.from(parent.getContext()), parent);
      }
  
      @Override
      public void onBindViewHolder(ViewHolder holder, int position) {
          // no-op
      }
  
      @Override
      public int getItemCount() {
          return LENGTH;
      }
  }
  // end recycleview.adapter wrapping viewholder created
  
  @Override
  public void onDetach() {
      super.onDetach();
  }
  </code></pre>
  
  <p>}</p>