title: Android, AdMob: AdMob ad refresh destroys frame rate
body: <p>I am developing a game and it's coming along quite nicely. I do have a bit of a problem about the AdMob ad refreshing though. Every time the ad is refreshed or it draws a different aspect of the ad, my frame rate plummets and almost makes the game unplayable. Here is what I have for the loading of the ad...</p>
  
  <pre><code>    ad = new AdView(this, AdSize.BANNER, "...");
  
      AdRequest adRequest = new AdRequest();
      adRequest.addTestDevice("...");
      adRequest.addTestDevice("...");
  
      RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
              RelativeLayout.LayoutParams.WRAP_CONTENT,
              RelativeLayout.LayoutParams.WRAP_CONTENT);
      lp.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
      lp.addRule(RelativeLayout.CENTER_HORIZONTAL);
      ad.setLayoutParams(lp);
  
      RelativeLayout layout = new RelativeLayout(this);
      layout.addView(renderView);
      layout.addView(ad);
      ad.loadAd(new AdRequest());     
  
      setContentView(layout);
  </code></pre>
  
  <p>My solution for rendering the ad on top of the <code>SurfaceView</code> was to just add it to a <code>RelativeLayout</code> and add both the <code>SurfaceView</code> and <code>AdView</code> to it. This all works fine and dandy, but every time the ad refreshes (UI or new Ad request), it bogs down the UI thread, which in turn slows down my render thread.</p>
  
  <p>Is there a way that I can make all of this work together nicely to have all work done by the AdView done separately from the main thread? I am not too sure about dynamically updating the current layout from another thread.</p>
  
  <p>Thanks for the help.</p>