Can I load admob ad using AsyncTask ?
I have tried it but I get lots of warning at runtime and the ad is not loaded
one of the warning when I create new AdView instance is
07-06 09:57:31.170: W/webview(1113): java.lang.Throwable: Warning: A WebView method was called on thread 'AsyncTask #1'. All WebView methods must be called on the UI thread. Future versions of WebView may not support use on other threads.
my method looks like this
@Override
protected AdView doInBackground(Activity... activityParam)
{
Looper.prepare();
activity = activityParam[0];
// Create the adView
AdView adView = new AdView(activity, AdSize.BANNER, "xxxxxxxxxxxxx");
return adView;
}
Please advise if this should at all be called on non UI thread, the only reason I am doing it to prevent UI blocking..
Edit.
May be I did not express my problem properly,
I am trying to load the ad in background because it seems to block for some seconds, I do not want to block my activity's interface.
read this post How to avoid Admob blocking the UI thread where it is recommended that to avoid UI blocking one should use AsyncTask
So what I want to know if is alternate to load an ad in the background.. ?