title: How to preload admob ad in one fragment and show in another (Kotlin)?
body: <p>I want to load the ad in fragment A and show the ad in fragment B so there is no waiting for the ad to load in fragment B.</p>
  <p>I tried java code I found but I only succeeded to load the image, im not sure what is wrong in my code.</p>
  <p>my code:</p>
  <pre><code>class AdManager {
  
  companion object{
  
      var mInterstitialAd: InterstitialAd? = null
  
      fun loadInterstitialAd(context: Context){
  
          val adRequest = AdRequest.Builder().build()
  
          InterstitialAd.load(context,&quot;ca-app-pub-3940256099942544/1033173712&quot;, adRequest, object : InterstitialAdLoadCallback() {
              override fun onAdFailedToLoad(adError: LoadAdError) {
                  Timber.i(adError.message)
                  mInterstitialAd = null
              }
  
              override fun onAdLoaded(interstitialAd: InterstitialAd) {
                  Timber.i(&quot;Ad was loaded.&quot;)
                  mInterstitialAd = interstitialAd
              }
          })
      }
  }
  </code></pre>
  <p>Fragment A</p>
  <pre><code>AdManager.loadInterstitialAd(requireContext())
  </code></pre>
  <p>Fragment B</p>
  <pre><code>AdManager.mInterstitialAd!!.show(requireActivity())
  </code></pre>