所以,我有单独的绘图类,我想在那里画 adMob,我从游戏类中调用它并将活动作为参数传递:
public void drawAddMob(Activity a){
LinearLayout ll = new LinearLayout(a);
ll.setPadding(0, 50, 0, 0);
adView = new AdView(a, AdSize.BANNER, "a15140cd49b6e7b");
AdRequest request = new AdRequest();
adView.loadAd(request);
adView.setVisibility(View.VISIBLE);
ll.addView(adView);
ll.draw(canvas);
}
但是当我这样做时,我得到了错误:
03-21 23:35:09.646: W/System.err(333):
java.lang.RuntimeException: Can't create handler
inside thread that has not called Looper.prepare()
03-21 23:35:09.656: W/System.err(333):
at com.google.ads.internal.AdWebView.<init> (SourceFile:69)