2016-10-06 3 views
1

I native AdMob-Anzeigen in meinem RecyclerView zu zeigen versuchen, das Problem die NativeExpressAdView nur Liste annimmt, so ist es eine Möglichkeit, RealmResults umwandeln kann innative AdMob Ads mit Realm DataBase

private void setUpAndLoadNativeExpressAds() { 
    // Use a Runnable to ensure that the RecyclerView has been laid out before setting the 
    // ad size for the Native Express ad. This allows us to set the Native Express ad's 
    // width to match the full width of the RecyclerView. 
    mRecyler.post(new Runnable() { 
     @Override 
     public void run() { 
      final float density = getActivity().getResources().getDisplayMetrics().density; 
      // Set the ad size and ad unit ID for each Native Express ad in the items list. 

      //Here is the problem : 
      for (int i = 0; i <= randomQuote.size(); i += ITEMS_PER_AD) { 
       final NativeExpressAdView adView = 
         (NativeExpressAdView) randomQuote.get(i); 
       AdSize adSize = new AdSize(
         (int) (mRecyler.getWidth()/density), 
         NATIVE_EXPRESS_AD_HEIGHT); 
       adView.setAdSize(adSize); 
       adView.setAdUnitId(AD_UNIT_ID); 
      } 

      // Load the first Native Express ad in the items list. 
      loadNativeExpressAd(0); 
     } 
    }); 
} 

Antwort

0

zur Liste You kann Realm.copyFromRealm() verwenden.

+0

Können Sie mir bitte einen Beispielcode geben, was ich genau machen soll? –

+0

'RealmResults ergebnisse = realm.where(). FindAll(); Liste Personen = realm.copyFromRealm (Ergebnisse); ' – geisshirt