title: How can I use Database Helper class in CardView Adapter in android
body: <p>I have use <code>ViewPager</code> and this <code>ViewPager</code> to set <code>CardView</code> display the card about the person name and person images so I can use the helper class in adapter and set the person image to card and also name so how can use this..
  <strong>.I am new to Android programming please solve this problem.</strong></p>
  
  <p><strong>CardPagerAdapter</strong></p>
  
  <pre><code> private List&lt;CardView&gt; mViews;
  private List&lt;String&gt; mData;
  private float mBaseElevation;
  
  public CardPagerAdapter() {
  
      mData = new ArrayList&lt;&gt;();
      mViews = new ArrayList&lt;&gt;();
  
      for (int i = 0; i &lt; 5; i++) {
          mData.add("");
          mViews.add(null);
      }
  }
  
  public float getBaseElevation() {
      return mBaseElevation;
  }
  
  @Override
  public CardView getCardViewAt(int position) {
      return mViews.get(position);
  }
  
  @Override
  public int getCount() {
      return mData.size();
  }
  
  @Override
  public boolean isViewFromObject(View view, Object object) {
      return view == object;
  }
  
  @Override
  public Object instantiateItem(ViewGroup container, int position) {
      View view = LayoutInflater.from(container.getContext())
              .inflate(R.layout.viewpager_adapter, container, false);
      container.addView(view);
      CardView cardView = (CardView) view.findViewById(R.id.cv);
      ImageView imageView = (ImageView) view.findViewById(R.id.ivPeopelImage);
      imageView.setImageResource(R.drawable.ak_image);
  
      if (mBaseElevation == 0) {
          mBaseElevation = cardView.getCardElevation();
      }
  
      cardView.setMaxCardElevation(mBaseElevation * MAX_ELEVATION_FACTOR);
      mViews.set(position, cardView);
      return view;
  }
  
  @Override
  public void destroyItem(ViewGroup container, int position, Object object) {
      container.removeView((View) object);
      mViews.set(position, null);
  }
  </code></pre>
  
  <p><strong>Viewpage Class</strong></p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_alertme);
  
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
  
      mViewPager = (ViewPager) findViewById(R.id.viewPager);
      mCardAdapter = new CardPagerAdapter();
      mCardShadowTransformer = new ShadowTransformer(mViewPager, mCardAdapter);
      mViewPager.setAdapter(mCardAdapter);
      mViewPager.setPageTransformer(false, mCardShadowTransformer);
      mViewPager.setOffscreenPageLimit(3);
  }
  </code></pre>