-5

I have used google admob on another page but i want to use fb audience network banner ads also but its showing error. My code is :

  adView = new AdView(BhaktiPlayer.this, "539967309761431_541729399585222", AdSize.RECTANGLE_HEIGHT_250);

        // Find the Ad Container
        LinearLayout adContainer = (LinearLayout) findViewById(R.id.banner_container);
        // Add the ad view to your activity layout
        adContainer.addView(adView);
        // Request an ad
        adView.loadAd();

and showing errors:

Error:(57, 48) error: incompatible types: String cannot be converted to AttributeSet

Error:(64, 15) error: method loadAd in class BaseAdView cannot be applied to given types;
required: AdRequest
found: no arguments
reason: actual and formal argument lists differ in length
Pradeep Sheoran
  • 367
  • 5
  • 13

2 Answers2

2

You may need the command notifyDataSetChanged(); have you looked into that?

RecyclerView does not offer a default update method, is up to you to call it everytime, this gives you much more flexibility.

As the post explains what you need to do is to call a method into the adapter that updates the view

public void updateData(ArrayList<ViewModel> viewModels) {
   items.clear();
   items.addAll(viewModels);
   notifyDataSetChanged();
}
trocchietto
  • 2,388
  • 1
  • 19
  • 33
  • actually i'm making a chat application so i want to change the color of tick from brown to green. when my recycler update then ticks sets as green but when i'm sending new message to user then it is not changing to green so how it check and convert into green. i need a code that detect delivery status and change tick brown to green without refresh Recycler view – Pradeep Sheoran Sep 06 '18 at 10:34
  • this is a completely different use case not related to what is meant to update the recyclerView as in your title. You should start a new question, but you can easily find the way making an if condition where you decide the color of the tag using a flag boolean variable, or even setting the visibility of the view. Please if you like accept my answer because is the one related to update recycler view, so that future users can read it. – trocchietto Sep 06 '18 at 11:57
0

When you change anything manually from firebase it will not take effect in your app because your app doesn't know what you have done manually unless you do it from code. If you do it from code then notifyDataSetChanged() is the method for you.

AIK
  • 418
  • 1
  • 5
  • 19