android-webview

Returning value from Javascript *reliably* to Webview

北慕城南 提交于 2021-02-19 08:38:17
问题 There is a way to call javascript function from webview and then let it call a method in Java to return the result. Like described in How to get return value from javascript in webview of android? Now, the javascript function can fail (say due to a typo in javascript file). In that case, I would like to carry out some failover code in Java. What is a good way to do that? My current code looks like this: In Java: private boolean eventHandled = false; @Override public void onEvent() {

Soft Keyboard not displaying on touch in WebView DialogFragment

半腔热情 提交于 2021-02-19 07:09:08
问题 Edit: I have looked at the error page for this; no answers work. It seems it is an Android system bug that has not yet been solved. First off I've referred to this similar question. But the solution to that question does not seem to be the solution to mine. I have a DialogFragment that contains only a WebView . Everything in the WebView seems to be touchable. However, the problem is that when I touch a form field, the cursor appears but the soft keyboard never shows up! Here's my code in the

Soft Keyboard not displaying on touch in WebView DialogFragment

試著忘記壹切 提交于 2021-02-19 07:07:24
问题 Edit: I have looked at the error page for this; no answers work. It seems it is an Android system bug that has not yet been solved. First off I've referred to this similar question. But the solution to that question does not seem to be the solution to mine. I have a DialogFragment that contains only a WebView . Everything in the WebView seems to be touchable. However, the problem is that when I touch a form field, the cursor appears but the soft keyboard never shows up! Here's my code in the

Netflix in Android WebView

∥☆過路亽.° 提交于 2021-02-18 19:13:09
问题 So let me preface this by saying downloading the Netflix App is not an option. So my thought is to just make a wrapper app that loads the netflix website in a WebView. This works for login/navigation; however, whenever you hit the play button to start playing the video, there is no response and no output in logcat. I'm looking for a way to see more debug messages from the WebView or a way to get the video playing. Using Android 4.4.4 by the way. View layout = LayoutInflater.from(mActivity)

Netflix in Android WebView

别说谁变了你拦得住时间么 提交于 2021-02-18 19:12:28
问题 So let me preface this by saying downloading the Netflix App is not an option. So my thought is to just make a wrapper app that loads the netflix website in a WebView. This works for login/navigation; however, whenever you hit the play button to start playing the video, there is no response and no output in logcat. I'm looking for a way to see more debug messages from the WebView or a way to get the video playing. Using Android 4.4.4 by the way. View layout = LayoutInflater.from(mActivity)

Web view onReceivedError is handled but still showing web page not available

二次信任 提交于 2021-02-17 05:26:03
问题 I was trying to show a web page on my web view. and in case if an error occurs or page loading fails I want to show a sad smiley and a text showing that your page is not loaded or anything like that. and for that I tried to put my code inside onReceivedError() but somehow it does not work except toasts and logs. My code is as follows: webView.setWebViewClient(new WebViewClient(){ @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { super.onPageStarted(view, url,

How to fire javascript event in Android WebView on app resume

你。 提交于 2021-02-10 13:15:15
问题 I have a WebView in my Android app, and I need to run a JavaScript function whenever the app/WebView is switched to (e.g. using the app switcher or tapping the icon from the home screen) the device wakes from sleep (with the app having still been on the screen when the device went to sleep). Using a visibilitychange event listener in my webpage javascript only works for case 1. Ideally I would like to trigger some kind of javascript event using the Android onResume() java function, but how?

Flutter WebView blob pdf download

不打扰是莪最后的温柔 提交于 2021-02-08 09:06:49
问题 I am trying to download a file from a website using flutter, I first used evaluateJavaScript and changed some values before clicking a generate button wich is supposed to download an appropriate pdf file to the phone. Here is my code : InAppWebView( initialUrl: '...', initialOptions: InAppWebViewGroupOptions( crossPlatform: InAppWebViewOptions( debuggingEnabled: true, useOnDownloadStart: true, javaScriptEnabled: true, ), ), //javascriptMode: JavascriptMode.unrestricted, onWebViewCreated:

Handle Touch Events inside WebView in android

99封情书 提交于 2021-02-08 08:16:57
问题 I had created WebView that loads html files from the asset folder. Now when i am going to put GestureDetecter in that WebView it stops working ScrollView & links inside html page. but when i removes GestureDetecter both ScrollView & links works fine. Following is my complete code, (I have used two html files 1.html & 2.html, you can use any html files instead of it which can allows scrolling and put both files into asset folder) import android.app.Activity; import android.content.Context;

Stored audio files using Android WebView is not working

狂风中的少年 提交于 2021-02-08 07:31:26
问题 I am trying to store audio files binary string into sdcard using android webview. But when I try to play an audio file in my mobile filemanager, the audio file is not playing. I am using JavaScript Interface for getting and saving audio file binary data into sdcard. I don't want to use an android download manager or another download manager for downloading files. I need to fix the below-posted code for audio play. Here is code: import androidx.appcompat.app.AppCompatActivity; import android