The doc says I should add something like this to my code:

// 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(); 
} 
});

My layout is in xml and I have already defined setContentView(R.layout.config); I mean the layout.post(new Runnable() { line. How should I modify the code?

有帮助吗?

解决方案

For anyone who is interested I have found the obvious solution:

  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 is the layout of the .xml file.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top