WebViewClient webViewClient = new WebViewClient() {
@SuppressWarnings("deprecation") @Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
loadURLs(view, url);
return true;
}
@TargetApi(Build.VERSION_CODES.N) @Override
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
loadURLs(view, request.getUrl().toString());
return true;
}
public void loadURLs(WebView view, String url){
view.loadUrl(url);
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
if(url.indexOf("file:///android_asset/") == 0){
webView.addJavascriptInterface(new JavaScriptInterface(curact),"JavaFunc");
} else {
webView.removeJavascriptInterface("JavaFunc");
}
super.onPageStarted(view, url,favicon);
}
};
Мне надо возвратить return c текстом ответа сервера синхронно, т.е. дождавшись ответа.