title: How to access SQLite database in androidRecyclerVIew?
body: <p>I've created a SQLite database which contains two columns: "title" and "content" and don't have any idea how to display it in my android RecyclerView with two textViews "card_title" and "card_content". please kindly help me with this.
  Here is my recycler adapter:</p>
  
  <pre><code>public class RecyclerAdapter extends RecyclerView.Adapter&lt;RecyclerAdapter.ViewHolder&gt; {
      private ClipboardManager myClipboard;
      private ClipData myClip;
      private Context context;
  
  
  
  
  
      public List&lt;CardItemModel&gt; cardItems;
  
      public RecyclerAdapter(List&lt;CardItemModel&gt; cardItems){
          this.cardItems = cardItems;
      }
  
      public static class ViewHolder extends RecyclerView.ViewHolder{
          ImageView copyButton;
          ImageView shareButton;
          ToggleButton favButton;
  
  
  
          TextView title;
          TextView content;
          public ViewHolder(View itemView) {
              super(itemView);
              this.title = (TextView)itemView.findViewById(R.id.card_title);
              this.content = (TextView)itemView.findViewById(R.id.card_content);
              this.copyButton= (ImageView) itemView.findViewById(R.id.copyButton);
              this.shareButton=(ImageView) itemView.findViewById(R.id.shareButton);
  
              this.favButton=(ToggleButton) itemView.findViewById(R.id.favButton);
  
              favButton.setChecked(false);
              favButton.setBackgroundDrawable(ContextCompat.getDrawable(favButton.getContext(), R.mipmap.ic_launcher));
  
  
          }
      }
  
  
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_item,parent,false);
          ViewHolder viewHolder = new ViewHolder(view);
  
          return viewHolder;
      }
  
      @Override
      public void onBindViewHolder(final ViewHolder holder, int position) {
          holder.title.setText(cardItems.get(position).title);
          holder.content.setText(cardItems.get(position).content);
          holder.copyButton.setOnClickListener(new View.OnClickListener(){
              public void onClick(View v){
  
  
                  myClipboard = (ClipboardManager) v.getContext().getSystemService(Context.CLIPBOARD_SERVICE);
  
  
                  myClip = ClipData.newPlainText("label", holder.content.getText().toString());
                  myClipboard.setPrimaryClip(myClip);
                  Toast.makeText(v.getContext(), "Copied to clipboard" , Toast.LENGTH_SHORT ).show();
  
              }
          });
          holder.shareButton.setOnClickListener(new View.OnClickListener(){
              public void onClick(View v){
                  Intent share = new Intent(Intent.ACTION_SEND);
                  share.setType("text/plain");
                  share.putExtra(Intent.EXTRA_TEXT, holder.content.getText().toString());
                  v.getContext().startActivity(Intent.createChooser(share, "Share Text"));
              }
          });
  
          holder.favButton.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
              @Override
              public void onCheckedChanged(CompoundButton favButton, boolean isChecked){
                  if (isChecked)
                      favButton.setBackgroundDrawable(ContextCompat.getDrawable(favButton.getContext(),R.mipmap.ic_launcher));
  
                  else
                      favButton.setBackgroundDrawable(ContextCompat.getDrawable(favButton.getContext(), R.mipmap.ic_cart));
              }
          });
      }
  
      @Override
      public int getItemCount() {
          return cardItems.size();
      }
  }
  </code></pre>