Mopub: MOVE_ALL_ADS_WITH_CONTENT MoPubRecyclerAdapter.ContentChangeStrategy doesn't seem to work

android

#1

Hello

I’m just trying to do the following:

myMoPubAdapter = new MoPubRecyclerAdapter(this, myInnerAdapter);
myMoPubAdapter.setContentChangeStrategy(MoPubRecyclerAdapter.ContentChangeStrategy.MOVE_ALL_ADS_WITH_CONTENT);
// Create an ad renderer and view binder that describe your native ad layout.
ViewBinder myViewBinder = new ViewBinder.Builder(R.layout.my_ad_layout)
        .titleId(R.id.my_ad_title)
        .textId(R.id.my_ad_text)
        .mainImageId(R.id.my_ad_image)
        .iconImageId(R.id.my_ad_icon)
        .callToActionId(R.id.my_call_to_action)
        .privacyInformationIconImageId(R.id.native_ad_privacy_information_icon_image)
        .build();

MoPubStaticNativeAdRenderer myRenderer = new MoPubStaticNativeAdRenderer(myViewBinder);
myMoPubAdapter.registerAdRenderer(myRenderer);
rv.setAdapter(myMoPubAdapter);

I just want the ads to be fixed to a specific position. Lets say when the app first starts, the ad is at position 2 and subsequently, I inserted a post at the top of my feed, I want the ad to feature in position 3. This just makes logical sense.

If I add the line to the code:

    `myMoPubAdapter.setContentChangeStrategy(MoPubRecyclerAdapter.ContentChangeStrategy.MOVE_ALL_ADS_WITH_CONTENT);`

Nothing is displayed in my feed - the ads which were previously displayed in my feed have now disappeared.

If I take the line out, the ads are displayed again but with the ads maintain their position, so if I have an add in position 2 and I insert a new post at the top of my feed, the ad will still be at position 2.

How can I get the ad move with the content?