Wes,
The best I can figure, this is a null value returned from the Ad, as
indicated in the line:
"android.webkit.WebView.loadDataWithBaseURL(WebView.java:1964)"
I can only guess, because as William points out, we don't have the
source code. But here are two similar errors that would lead me to
believe this.
The first set of code below produces the "c.a" error from the bottom
part of William's code, then further below is the "invalidate" error,
which is what the WebView is doing in the top portion of William's
code. It seems an AdRequest null value throws an error, it is caught
and then WebView tries to update the AdView to handle the error, but
it's in the background thread and it throws an uncaught exception.
First, this is the code for a similar error for a null pointer:
AdView adView;
AdListener adListener;
AdRequest adRequest;
onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mylayout);
adView = (AdView)findViewById(R.id.adView);
adView.loadAd(adRequest);
adListener = new AdListener();
adView.setAdListener(adListener);
adListener = null;
}
also:
onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mylayout);
adView = (AdView)findViewById(R.id.adView);
adView.loadAd(adRequest);
adListener = new AdListener();
adView.setAdListener(adListener);
adRequest = null;
}
Although this is not what happens in practice, if onPause/onStop/
onDestroy makes AdListener or AdRequest null while the AdView Asynch
task is running, it is effectively what happens (and an error occurs).
This is common with a configuration change, which is probably the
primary reason this error happens.
Here's the logcat which shows the error is similar, but not the same:
07-15 00:58:53.367: ERROR/AndroidRuntime(417): FATAL EXCEPTION:
AsyncTask #1
07-15 00:58:53.367: ERROR/AndroidRuntime(417):
java.lang.RuntimeException: An error occured while executing
doInBackground()
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
android.os.AsyncTask$3.done(AsyncTask.java:200)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:
273)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.FutureTask.setException(FutureTask.java:124)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1068)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:561)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.lang.Thread.run(Thread.java:1096)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): Caused by:
java.lang.NullPointerException
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at c.a(Unknown
Source)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at c.a(Unknown
Source)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
c.doInBackground(Unknown Source)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
android.os.AsyncTask$2.call(AsyncTask.java:185)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-15 00:58:53.367: ERROR/AndroidRuntime(417): ... 4 more
Here is the "invalidate" portion:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
adView = (AdView)findViewById(R.id.adView);
// relative layout with adview in it
adLayout = (RelativeLayout)findViewById(R.id.adLayout);
Thread getAdThread = new Thread(null, killAd, "Kill Ad");
adHandlerThread.start();
}
private Runnable killAd = new Runnable() {
@Override
public void run () {
adLayout.setVisibility(View.INVISIBLE);
}
};
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): android.view.ViewRoot
$CalledFromWrongThreadException: Only the original thread that created
a view hierarchy can touch its views.
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.ViewRoot.checkThread(ViewRoot.java:2802)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.ViewRoot.invalidateChild(ViewRoot.java:607)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.ViewRoot.invalidateChildInParent(ViewRoot.java:633)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.ViewGroup.invalidateChild(ViewGroup.java:2505)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.View.invalidate(View.java:5139)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.View.setFlags(View.java:4516)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
android.view.View.setVisibility(View.java:3030)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
com.secondphoneapps.SpaLocationJumperFree.SpaLocHome
$5.run(SpaLocHome.java:243)
07-15 03:03:46.426: ERROR/AndroidRuntime(1204): at
java.lang.Thread.run(Thread.java:1096)
Hope that helps. We would really like this fixed.
-Jim