title: Embedding ads within Recyclerview
body: <p>I am trying to upgrade my app from listview to recyclerview. When I was using listview I had embedded ads within the listview using <a href="http://googleadsdeveloper.blogspot.in/2012/03/embedding-admob-ads-within-listview-on.html" rel="noreferrer">this tutorial</a>. </p>
  
  <p>I am not able to add it within recyclerview similarly. Any views on how this is to be done in a Recyclerview?</p>
  
  <p><strong><em>Currently in my listview the code is as below for loading ads:</em></strong></p>
  
  <pre><code>    if ((position % k) == 0) {
        if (convertView instanceof AdView) {
          return convertView;
        } else {
          // Create a new AdView
          AdView adView = new AdView(activity, AdSize.BANNER,
                                     ADMOB_ID);
  
          float density = activity.getResources().getDisplayMetrics().density;
          int height = Math.round(AdSize.BANNER.getHeight() * density);
          AbsListView.LayoutParams params = new AbsListView.LayoutParams(
              AbsListView.LayoutParams.FILL_PARENT,
              height);
          adView.setLayoutParams(params);
  
          adView.loadAd(new AdRequest());
          return adView;
        }
      } else {
        return delegate.getView(position - (int) Math.ceil(position / k) - 1,
            convertView, parent);
      }
  </code></pre>
  
  <p><strong><em>This is how it should look:</em></strong></p>
  
  <p><img src="https://i.stack.imgur.com/QAgbr.png" alt="ListView Items"></p>
  
  <p><strong><em>Update:</em></strong> Refer <a href="https://www.youtube.com/watch?v=LZCZSeFTvyk" rel="noreferrer">this video</a> from google, it gives the complete explanation </p>