java - Admob Adview works. Why? -


yesterday trying admob advertising work on new app. unfortunately, , embarassingly had programmed myself corner using minimal xml files in programming. (its long story why), i.e. did layouts views programatically in java. anyway, when came adding adview had problem since admob guide assumed developers use xml extensively. browsed admob api , blundered around , ended following:

   ad = new adview(this);     ad.setenabled(true);       sublayout.addview(ad);      simpleadlistener sal = new simpleadlistener();     sal.onreceivead(ad);      ad.setadlistener(sal);      ad.getadlistener();     ad. setkeywords("keywords relevant app");     ad.requestfreshad(); 

my question is, code ok? works. mean, i'm displaying ads on app (still unpublished). if has experience admob sdk id advice.

you can drop following lines:

ad.setenabled(true); simpleadlistener sal = new simpleadlistener(); sal.onreceivead(ad); ad.setadlistener(sal); ad.getadlistener(); 

this little bit confusing, associated internal ad listener interface admob publishes can listen happens. have here nothing.

reguestfreshad cause ad refreshed once, can use setrequestinterval set adview update after specified number of seconds. i'm assuming, since see ad, elsewhere adding view. other that, should go.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -