添加LeadBolt应用内广告 - 如何添加一个Runnable

问题描述:

的医生说我应该增加这样的事情我的代码:添加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。我应该如何修改代码?

+0

没有人?我不这和LeadBolt有什么关系,问题是如何设置runnable? – erdomester 2012-04-25 08:24:18

对于任何人谁是有兴趣的,我发现了明显的解决方案:

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文件的布局。