PDA

View Full Version : Get AdMob in SurfaceView



smarcus3
08-02-2011, 11:44 AM
How do you implement AdMob via this 2d graphics example (http://www.android10.org/index.php/articlesgraphicsaudiovideo/155-playing-with-graphics-in-android-part-v). My code is slightly more complicated but the overall engine is the same.

I have tried a few different options but i cant get it to work. here is a link of one : http://rx-games.com/admob-adverts-on-surfaceview-no-xml-tutorial/

Please help.


Thanks in advance
Steve

spwebgames
10-09-2011, 12:27 PM
Why not just have the SurfaceView and the Admob view in either a vertical linear layout or a relative layout?
In the past, I have used the XML-based layout to create something like:

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<MySurfaceView
android:id="@+id/MySurfaceView"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</MySurfaceView>
<com.google.ads.AdView
android:id="@+id/Ad"
android:layout_width="fill_parent"
android:layout_height="50dp"/>
</RelativeLayout>