1: import com.google.ads.*;
2:
3: public class Test_Normal_1 extends Cocos2dxActivity{
4: private Cocos2dxGLSurfaceView mGLView;
5:
6: private AdView adView;
7:
8: protected void onCreate(Bundle savedInstanceState){
9: super.onCreate(savedInstanceState);
10:
11: // get the packageName,it's used to set the resource path
12: String packageName = getApplication().getPackageName();
13: super.setPackageName(packageName);
14:
15: setContentView(R.layout.game_demo);
16: mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.game_gl_surfaceview);
17: mGLView.setTextField((EditText)findViewById(R.id.textField));
18:
19: adView = new AdView(this, AdSize.BANNER, "a150189a3abeb1a");
20:
21:
22: LinearLayout layout = (LinearLayout)findViewById(R.id.AdLayout);
23: layout.addView(adView);
24:
25: adView.loadAd(new AdRequest());
26:
27: }
1: <LinearLayout
2: android:id="@+id/AdLayout"
3: android:layout_width="wrap_content"
4: android:layout_height="wrap_content"
5: ></LinearLayout>