javascript - JavescriptInterface and thread not returning to main thread -
i'm developing app android , of content displayed via webview.
i have interface javascript this.
webappinterface(context c, response response) { activity = (activity) c; delegate = response; context = c; } /** show toast web page */ @javascriptinterface public void getresponse(final string operation, final string response, final string type) { final handler mainhandler = new handler(context.getmainlooper()); mainhandler.post(new runnable() { @override public void run() { delegate.didgetresponse(operation, response, type); log.d("success: ", "im still here"); <-- why not in main thread? } }); } public interface response { public void didgetresponse(string operation, string response, string type); }
my activity implements didgetresponse , have switch executes code , update webview if needed on first function in webview after page set webview not respond anymore "clicks"
i'm thinking because thread still in javascriptinterface?
however native buttons can still update webview. want able call js functions newly loaded url in webview
okay, found answer turns out calling javascript function little arguments. solution worked , problem js function had 2 arguments instead of 3 on page. different swift did work 2 arguments.
Comments
Post a Comment