android-webview

Android webview is playing video only once

☆樱花仙子☆ 提交于 2019-12-25 07:26:22
问题 I am using webview in android to play a video. The problem is that video is playing once. I have seen some answers about how to fix it, but still not working. Here's my code: public class MyChromeClient extends WebChromeClient implements OnCompletionListener, OnErrorListener { private Activity _activity; private VideoView mCustomVideoView; private LinearLayout mContentView; private FrameLayout mCustomViewContainer; private WebChromeClient.CustomViewCallback mCustomViewCallback; static final

Android WebView JavaScript callbacks fail in APK without Proguard

允我心安 提交于 2019-12-25 05:12:31
问题 I'm exposing @JavascriptInterface callbacks for a WebView which work just fine when debugging the app via Android Studio, however if the app is installed via APK the JavaScript callbacks fail with: "Uncaught TypeError: NativeApp.onProgress is not a function" I'm aware that improper Proguard rules can result in this problem, but in this case the project is not using Proguard and the problem occurs with debug and release APKS. If I inspect the APKs, the methods are present. public class

shouldOverrideUrlLoading() not called for external links from iframe

混江龙づ霸主 提交于 2019-12-25 04:11:57
问题 Although issues with shouldOverrideUrlLoading() are well discussed in SO (I probably read most of them), I still didn't find a solution to what seems to me such a generic problem, that I believe has been solved. The QUESTION: How to stop in shouldOverrideUrlLoading() for external links, e.g. "http://www.example.com", for pages I loaded with webView.loadDataWithBaseURL(), where baseUrl is "file:///..."? My override method for shouldOverrideUrlLoading() is not called when external links are

Android button as WebView click link for Logout (or delete sessionId)

梦想的初衷 提交于 2019-12-25 02:08:14
问题 In my WebView android, I want the user to logout on button click or any other way. I don't want to show any webpage after clicking that button. After that app should auto-exit(System.exit(0) will do that) Click I want to send is: http://192.100.1.1:10000/app?service=direct/1/UserSummary/$UserBorder.logoutLink What's the best way of doing this? 回答1: Use Rest to make a get call to this URL. To make it use an async task: See an example here. In your do in background do: protected String

How to restrict the WebView inside in android program

ε祈祈猫儿з 提交于 2019-12-25 01:51:21
问题 i want to restrict webView's limit inside some pixels which is have declared at the time of webView initialization . View insertPoint = findViewById(R.id.layout); WebView web = new WebView(this) ; web.setBackgroundColor(Color.GRAY); int lHeight = 200 ; int lWidth = 200 ; ( (ViewGroup) insertPoint ).addView(web, lWidth, lHeight) ; web.loadUrl("http://www.google.com"); Edited : Full Screen is taken by that WebView , it is not residing inside 200px*200px . Edited : <LinearLayout xmlns:android=

pass sms:?body=xyz to default browser in android webview

狂风中的少年 提交于 2019-12-25 01:49:33
问题 I Am Using Webview For Display html page page have link like <a href="sms:body=xym">Forward</a> Which Working Fine In Opera And Default Browser But Not Working In Application using webview I Try below code but not working public boolean shouldOverrideUrlLoading(WebView myWebView, String url) { if (url != null && url.startsWith("sms:?")) { myWebView.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); return true; } else { return false; } } 回答1: There is a mistake in

Video is not started inside WebView in android API 25

≡放荡痞女 提交于 2019-12-25 01:25:25
问题 I'm new to android and sorry in advance if my question is trivial but I was not able to find any solution for it. I'm working on an android project and I have a WebView that displays a web page from the assets directory, my web page has a video element as shown below <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>video player</title> </head> <body> <video width="400" controls autoplay loop muted> <source src="./assets/video/video1.webm" type="video/webm"> </video> </body> </html>

Web View Zooming Control

。_饼干妹妹 提交于 2019-12-24 20:19:36
问题 htmlp = URLEncoder.encode(desc,"utf-8").replaceAll("\\+"," "); WebView wv=(WebView)findViewById(R.id.webView1); wv.setInitialScale(70); wv.getSettings().setJavaScriptEnabled(true); wv.getSettings().setPluginsEnabled(true); wv.getSettings().setSupportZoom(true); wv.getSettings().setLoadWithOverviewMode(true); wv.getSettings().setBuiltInZoomControls(true); wv.loadData(htmlp,"text/html", "utf-8"); In htmlp contains HTML content(tags). Now I have to enable zooming control, but using above code it

Android Webview - Uncaught ReferenceError in local javascript execution

谁都会走 提交于 2019-12-24 19:06:17
问题 Hello everyone and thanks for your help! I want to build a Android Webview App, it uses HTML + CSS + javascript with no library except the highcharts one. It works perfectly well cross-browser when I try it with the files on the server. I want to have as many files as possible running locally client-side: the HTML, CSS, all assets (images) and javascript codes are in the app, leaving only the php files on the server (login, signin, etc.). Unfortunately, when I try my app on Android, I get

Is there a way to pass result of localstorage:getItem() to activity from webview

不羁岁月 提交于 2019-12-24 18:54:19
问题 Am using webview to load a page in android. Once the page is loaded, localstorage is updated. I want to retrieve data from it. Above kitkat, using evaluateJavascript am able to obtain the data. It have a callback. The problem is with versions below kitkat, where i have to use loadUrl() for it. loadUrl("javascript:localStorage.getItem('"+ key +"')"); I want to pass the value returned by function getItem(), to calling activity. 回答1: you can do it. First you need to add javascript interface to