i want load interstitial ad in activity and show it in another activity . i 
found this topic and try to do the steps in the first answer but there are 
a lot errors .
How To preload admob interstitial ad and send to another android activity 
using intent 
<http://stackoverflow.com/questions/26852032/how-to-preload-admob-interstitial-ad-and-send-to-another-android-activity-using>

That what i did :

   - 
   
   I created a public class and named it "AdManager" and put this code in 
   it:
   
   - 
      - 
      
      `package com.website.test;
      import com.google.android.gms.ads.InterstitialAd;
      
      
      
      public class AdManager {
      
      
      // Static fields are shared between all instances.
      static InterstitialAd ad;
      
      
      public AdManager() {
          createAd();
      }
      
      
      public void createAd() {
          // Create an ad.
          interstitialAd = new InterstitialAd(this);
          interstitialAd.setAdUnitId("");
      
      
      AdRequest adRequest = new AdRequest.Builder()
              .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
              .addTestDevice(TEST_DEVICE_ID).build();
      
      // Load the interstitial ad.
      interstitialAd.loadAd(adRequest);
      }
      public InterstitialAd getAd() {
          return ad;}}
      
      - 
      
   In create event of class A i put this :
   - AdManager adManager = new AdManager();
   adManager.createAd();
   
   - 
      - In create event of the activity which i want show interstitial ad i 
      put this :
      - 
      
   InterstitialAd ad = admanager.getAd();
           if (ad.isLoaded) {
               ad.show();
           }
   
   
   - 
   
   but there are some errors as it shown in the pics i attached , please 
   tell me what is wrong ?
   
   - 
   
   <http://i.stack.imgur.com/mY4hL.jpg>
   
   
<http://i.stack.imgur.com/WGBcz.jpg>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to