I try to show Admob on my SurfaceView.
- I use framework from book beginning android games from Mario Zechner
- In framework there is a class (AndroidFastRenderView extends SurfaceView implements Runnable) and in that class there is line canvas.drawBitmap(framebuffer, null, dstRect, null); where framebuffer is Bitmap where is all drawn in game.
- In that framework there is a class (AndroidGame extends Activity) where is line setContentView(renderView);
Here renderView is AndroidFastRenderView that is SurfaceView, Now I try to add Admob but I don’t no how.
I can create Admob like this
AdView adView = new AdView(this, AdSize.BANNER, “MyID”);
but where to add that view
Thanks for help.
AdMob’s Ad Catalog sample application has an example similar to this. In the above example, the
AdViewwas defined in XML. But at a high level, you’ll probably want something like this:Where the
AdViewsits at the top or bottom outside of the AndroidFastRenderView. If you’re doing it in code, I’d suggest you create aRelativeLayout, add theAdViewas a subView of theRelativeLayoutat the bottom (for example), and then add therenderViewas a subView of theRelativeLayout, but above theAdView.