pinsipito
06/08/12, 15:34:56
Hola: tengo un problema con admob, no he conseguido implementarlo, y he probado mil maneras, tantas que decidi hacer un proyecto nuevo aposta para implementarlo y comprenderlo :S pero al escribir el código me da un problema en estas líneas:
Código:
protected void onSetContentView() {
final FrameLayout frameLayout = new FrameLayout(this);
final FrameLayout.LayoutParams frameLayoutLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams. FILL_PARENT,
FrameLayout.LayoutParams.FILL_PARENT);
final AdView adView = new AdView(this, AdSize.BANNER, "MI_CODIGO_ADMOB");
adView.refreshDrawableState();
adView.setVisibility(AdView.VISIBLE);
final FrameLayout.LayoutParams adViewLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams. WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT,
Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM);
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_ DIP, 50,
getResources ().getDisplayMetrics ());
adViewLayoutParams.topMargin = height/2;
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice( AdRequest.TEST_EMULATOR);
adView.loadAd(adRequest);
this.mRenderSurfaceView = new RenderSurfaceView(this);
this.mRenderSurfaceView.setRenderer(mEngine);
final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams=
new FrameLayout.LayoutParams(super.createSurfaceViewLa youtParams());
frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams);
frameLayout.addView(adView, adViewLayoutParams);
this.setContentView(frameLayout, frameLayoutLayoutParams);
}
Si alguien sabe que ocurre por favor que me corrija! o alguna forma de implementar admobs de manera mas sencilla T.T
Código:
protected void onSetContentView() {
final FrameLayout frameLayout = new FrameLayout(this);
final FrameLayout.LayoutParams frameLayoutLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams. FILL_PARENT,
FrameLayout.LayoutParams.FILL_PARENT);
final AdView adView = new AdView(this, AdSize.BANNER, "MI_CODIGO_ADMOB");
adView.refreshDrawableState();
adView.setVisibility(AdView.VISIBLE);
final FrameLayout.LayoutParams adViewLayoutParams =
new FrameLayout.LayoutParams(FrameLayout.LayoutParams. WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT,
Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM);
int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_ DIP, 50,
getResources ().getDisplayMetrics ());
adViewLayoutParams.topMargin = height/2;
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice( AdRequest.TEST_EMULATOR);
adView.loadAd(adRequest);
this.mRenderSurfaceView = new RenderSurfaceView(this);
this.mRenderSurfaceView.setRenderer(mEngine);
final android.widget.FrameLayout.LayoutParams surfaceViewLayoutParams=
new FrameLayout.LayoutParams(super.createSurfaceViewLa youtParams());
frameLayout.addView(this.mRenderSurfaceView, surfaceViewLayoutParams);
frameLayout.addView(adView, adViewLayoutParams);
this.setContentView(frameLayout, frameLayoutLayoutParams);
}
Si alguien sabe que ocurre por favor que me corrija! o alguna forma de implementar admobs de manera mas sencilla T.T