Admob Native Express Ads in RecyclerView

Admob Native Express Ads in RecyclerView - Banner - Know My Work

SVB

I am an Engineer by profession. I love to learn new technology stacks and share my learning with people.

Leave a Reply

Comment as a guest.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  1. I am facing Class cast exception for the RecyclerViewAdapter on Bind method for nativeExpressAdview display. Can you please help me?

    1. Hi Mukund,

      If you are getting a class cast exception in the Bind method for the nativeExpressAdview, it means the item at that position in the dataset is not of type nativeExpressAdview. Just check your logic for getItemViewType() and position of ads in your dataset. If you still face the problem, just send me your code for RecyclerViewAdapter.

  2. Hi SVB,

    I am getting the following error when i run the code inside a recyclerview of Fragment

    The ad size can only be set once on AdView.

    Can you please let me know how to solve it.

    1. This exception occurs when the ad size on ad view is being set more than once. I believe you have changed the above code as per your need and using the latest ad type provided by Google. You must check for instances in your code, where you are setting ad size. Comment that line and then run you code. In this way you will be able to debug your code.

      1. Thanks for replying Sir,

        I was new to admob, i have figured out that now i need to use unifiednativead instead of native express..

        I have changed the code and I have referred to codelabs of unified native ads in recyclerview.

        My unique problem is I have firebase database which has its own onchildadded listener to fetch my own data and unified ad listener due to which my arrays get mingledup… And UI too becomes freezing …

        Can you try unified ads with recyclerview along with firebase database???

        If you have any reference to this problem can you please provide ad it will be helpful to me

        1. I have not implemented this scenario yet. But the logic remains the same. Now you need to add your ad views inside firebase database listeners. I will definitely try to write a post over this. But you can always find the help on stackoverflow.

          1. If I am right, you must have already replaced LinearLayoutManager with GridLayoutManager. Apart from this, as you have three items per row, you need to change the value of variable ‘spaceBetweenAds’ to a multiple of 3 like 3, 6, 9 and so on, based on after how many items you want to show an Ad but it should in multiple of 3.

  3. Sir i have implemented the above code exactly but it always show in log failed to load ad loading next ad…and i am using test id’s

Read Next

Sliding Sidebar

About Me

About Me

I am an Engineer by profession. I love to learn new technology stacks and share my learning with people.

Follow Me

Subscibe for Newsletter