添加 LeadBolt 应用广告 - 如何添加 Runnable



文档说我应该在我的代码中添加这样的东西:

// create a new layout 
LinearLayout layout = new LinearLayout(this); 
/* 
Add any elements to your view 
*/ 
// make the view visible 
this.setContentView(layout); 
final Activity act = this;  
// now add the banner or overlay to the app 
layout.post(new Runnable() {  //what about this line?
public void run() { 
myController = new AdController(act, MY_LB_SECTION_ID); 
myController.loadAd(); 
} 
});

我的布局是xml,我已经定义了setContentView(R.layout.config);我的意思是layout.post(new Runnable() { line.我应该如何修改代码?

对于任何感兴趣的人,我找到了显而易见的解决方案:

  RelativeLayout rellaymain = (RelativeLayout)findViewById(R.id.rellaymain); 
        final Activity act = this;  
        rellaymain.post(new Runnable() {
            public void run() { 
            myController = new AdController(act, MY_LB_SECTION_ID2); 
            myController.setAsynchTask(true);
            myController.loadAd(); 
            } 
            //});
        });

Rellaymain是.xml文件的布局。

最新更新