PDA

Ver la Versión Completa : Ayuda con código admob !!!!


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

pinsipito
06/08/12, 22:09:29
Alguna ayuda por favor???

manusm
09/08/12, 09:39:53
Hola pinsipito, pues es un poco largo y para no enrollarme te dejo un enlace a mi web donde lo tengo muy bien explicado, si tienes dudas comentamelas.

http://errorwindows.blogspot.com.es/2012/08/implementar-admob-en-eclipse.html