0
我不知道如何得到這個我遊戲中的工作...AdMod&GLSurfaceView
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
glView = new GLSurfaceView(this);
glView.setRenderer(this);
setContentView(glView);
int newID = glView.getId();
// Create the adView
AdView adView = new AdView(this, AdSize.BANNER, "a14e3ef0948eb58");
// Lookup your LinearLayout assuming it’s been given
// the attribute android:id="@+id/mainLayout"
LinearLayout layout = (LinearLayout)findViewById(newID);
// Add the adView to it
layout.addView(adView);
Initiate a generic request to load it with an ad
adView.loadAd(new AdRequest());
}
這給了我一個空指針異常,我無法弄清楚還有什麼與此有關。我只是需要知道如何使這個工作與我編程的方式。我不使用任何XML。
也是「NEWID」值成爲-1所以多數民衆贊成在錯誤是來自
未來的任何幫助將不勝感激
感謝