MoPub Native Ad integration with viewholder pattern in Android

android
ads

#1

I am using a grid adapter (extends from ArrayAdapter) with viewholder. I wrapped it with MoPubAdAdapter. Ad shows up in gridview but when I click an item, it gives me wrong one (actually, one or two item later). I think it happens because of viewholder. The item of ad that is not on the screen at the time disappers and the positioning of items get fixed, but as soon as an ad appear on the screen the positioning is broken again.

How can I fix it? Do I have to do custom integration? If so, how can I do it? Is there any documentation about it?

I used this code for MoPub integration:

// Set up a ViewBinder and MoPubNativeAdRenderer as above.
ViewBinder viewBinder = new ViewBinder.Builder(R.layout.native_ad_layout)
        .mainImageId(R.id.native_ad_main_image)
        .iconImageId(R.id.native_ad_icon_image)
        .titleId(R.id.native_ad_title)
        .build();

// Set up the positioning behavior your ads should have.
MoPubNativeAdPositioning.MoPubServerPositioning adPositioning =
        MoPubNativeAdPositioning.serverPositioning();
MoPubNativeAdRenderer adRenderer = new MoPubNativeAdRenderer(viewBinder);

// Set up the MoPubAdAdapter
mAdAdapter = new MoPubAdAdapter(mContext, adapter, adPositioning);
mAdAdapter.registerAdRenderer(adRenderer);
loadAds();

I also asked it on stackoverflow. But there is no answer. http://stackoverflow.com/q/32269471/4557274