androidandroid-recyclerviewadmobnative-ads

Admob native advance Ads repeating in recycler view


I ran this(Google Codelab Native Ads) code and the native ads in the list are sometimes working fine but most of the time they are like the bottom two screenshots. They are not in order and repeating themselves.

Can anyone please check whats wrong in this demo code? Tried on different devices but no luck :(

Screenshot1.

enter image description here

Screenshot2

enter image description here


Solution

  • Only two things in your RecyclerView adapter

      @Override
        public long getItemId(int position) {
        return position;
      }
    

    and in constructor of adapter setHasStableIds(true);

    I tried this on same demo and git it working correctly.