For various reasons, I need to runOnUiThread() the actual instantiation & initialization of WebView.
Which means that its underlying HTTP connections are also made on the UI thread?
If this is true, is it possible to separate the WebView's UI thead from the HTTP connections thread?
If it is possible, what is the proper way of accomplishing this?
I find it very hard to believe that Android would run remote HTTP requests on the UI thread, assuming you initiate the requests via WebView.loadUrl()
. This would make for a terrible user experience.
Just quickly, I ran an Android app in the debugger, with a basic WebView
, and stopped in the debugger. Here's what I see:
If WebViewCoreThread
, WebViewWorkerThread
, or http0
- http3
aren't handling the network connections for WebView
objects, then
Also, if you look at this answer by one of stack overflow's highest reputation users, loadUrl() is asynchronous. A quick step through in the debugger tells me that loadUrl()
, which is called on the UI thread (aka main
), completes way too fast for the connection to be handled synchronously on the UI thread. (I put a breakpoint before and after the call to loadUrl()
with a URL that I know isn't served very quickly).
So, my answer is you're done ... they're already separate! (yeah!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With