android - Is it possible to change the context of a WebView after it has been instantiated? -


i have webview i'm loading in activity in order have preloaded pops in different activity (launched first).

the problem in order instantiate webview, have pass in context, in case it's first mentioned above.

so works great, , second activity shows webview fine. problem if click <select> dropdown in webview, selector dialog shows under webview. feels select doesn't work @ until hit button , briefly see selection dialog before return parent activity.

it seems though when append webview layout in second activity, it's modals attached activity's window, webview attached parent activity's window, shows in higher point in hierarchy.

how can possibly change context of webview after it's been instantiated?

this difficult problem solve -- have create webviews before activity started, need selection dialogs work.

please if can give me insights here i'd appreciate it.

this sdk project, not have access parent activity. also, savestate isn't working, because bulk of shown in webview generated javascript, , full dom stack doesn't transfer.

you can try create webview mutablecontextwrapper:

mutablecontextwrapper mmutablecontext=new mutablecontextwrapper(context); webview mwebview=new webview(mmutablecontext); 

and later on do

mmutablecontext.setbasecontext(newcontext); 

but ...

  • webview complex component using passed context create other objects handlers. webview uses handlers post stuff original ui thread, @ end you'll have view mix of contexts, know, double memory leak (if ever works properly)

  • webview spans @ least 1 thread "webcore" action happens , in constant communication original ui thread ... handlers? through original context? knows!

  • there 2 different webview engines: kitkat chromium-based while jelly bean , previous versions use aosp/webview. have additional breaking point.

  • the reasons state not strong enough imho. webview not slow. if app load is, try optimize it. there lot of things can that, loading html & graphics internal assets.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -