WebView
is most of the time inside an Activity
. So the Activity
, where the WebView
is, will always be there until you kill it. Unless you really want the Activity
to be really running on the background, then use a Service
instead.
Because you might need to use a Service
for what you want, then I guess you need to use a BroadcastReceiver
inside the Service
. Inside the BroadcastReceiver
, you have a custom tag that when called using a sendBroadcast()
will startActivity()
your webview/activity. I don't guarantee the speed of the loading for the WebView
because you mentioned that you want to preload the page but that'll do it. To lessen the load time for the WebView
, you must enable caching on the WebView
.
Another problem that I'm thinking that would happen if you really want to hold a WebView
on the background (if you can even do that) is memory leak. Because you want to keep the WebView
alive at all times even if it isn't even shown on the screen, you'll probably don't want it to be garbage collected which will be a really bad problem on android devices with low memory. You won't get it often on devices with lots of memory but not of 300mb devices.