How To Remove A Native Ad From The MoPubRecyclerAdapter on Android?



Is there a way to remove a specific native ad item/cell from the MoPubRecyclerAdapter?


The ability to remove a specific cell from Twitter MoPub’s MoPubRecyclerAdapter containing a native ad.

Use case: In a feed of content where the RecyclerView cells are dismissible it is important to keep the dismiss action consistent for the MoPub native ad cells in order to match the rest of the content. In addition, not being able to dismiss the native ads will create a scenario where multiple ads will be next to each other in the feed creating a poor user experience as the rest of the content is dismissed.


The function to dismiss a specific ad’s cell of the MoPubRecyclerAdapter is not accessible by the public API.

The MoPubStreamAdPlacer object which is responsible for managing the ads in a given feed contains a removeItem and removeAdsInRange method which provides the required functionality. However, the MoPubStreamAdPlacer object is private accessible within the MoPubRecyclerAdapter and therefore can not be utilized.

Potential Solution

Building a CustomMoPubRecyclerAdapter that extends MoPubRecyclerAdapter and making MoPubStreamAdPlacer publicly accessible.



It looks like this was addressed through GitHub. Sharing the thread here for the larger group. Thanks again for bringing this to our attention!