Tag: webview

Video in WebView – ApplicationContext vs Activity Context

I am playing a video in a WebView. If a memory leak is to be avoided, the ApplicationContext (as against an Activity context) has to be used to instantiate the WebView (refer to this) If I pass in the ApplicationContext and the VideoView inside the WebView needs to create a dialog (typically for ‘Cannot play […]

Android WebView always returns null for javascript getElementById on loadUrl

I try to fill out a form inside a webview from the android client app. I know how it should work, but the getElementById always returns null for me. I tried it on different websites. Here is my example for www.google.com. MyWebView view = new MyWebView(this); view.getSettings().setJavaScriptEnabled(true); view.loadUrl(“http://www.google.com”); view.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView […]

Android WebView crashes when clicking on a link

I have some WebView widgets inside my Activity. I use loadData() to set the content, and this html contains a link. Some of my WebViews work okay, when I click the link, the web browser is started in a new window, but some make my app crash when I click on a link. 10-13 08:45:24.257: […]

save/restore state of android webview

I have a simple webView app which loads a page from our site with locations and phone numbers that our field guys are supposed to visit each day. It provides a hook to launch navigation or dial the phone. When returning from the outside activity, the app is crashing. Hitting the phone’s home button then […]

Webview shouldOverrideUrlLoading works in previous android versions except 4.1.x jellybean

the following code works fine in all devices running android 2.x , but not in a Nexus 7 tablet with 4.1.2 The problem is that the shouldOverrideUrlLoading never run. The onPageFinished run ok I’ll appreciate any available help. wv = (WebView) root_view.findViewById(R.id.wv); wv.setBackgroundColor(res.getColor(R.color.def_bgr_color)); wv.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY); wv.setWebViewClient(new MyWebViewClient() ); WebSettings web_settings = wv.getSettings(); web_settings.setJavaScriptEnabled(true); web_settings.setLoadWithOverviewMode(true); web_settings.setUseWideViewPort(false); web_settings.setPluginsEnabled(true); […]

Flash inside Android WebView — How do I set fullscreen automatically?

I am loading Flash SWFs into an Android WebView. I want the SWF to be instantly fullscreen and focused. The class name that handles flash is com.adobe.flashplayer.FlashPaintSurface. Watching the log, when I fullscreen the flash manually, it calls com.adobe.flashplayer.FlashPaintSurface.toggleFullScreen(). The first part of my question is: How can I call that method manually for my […]

Webview to PDF ignores job name

I am trying to print an HTML-page from a webview on KitKat (4.4.4) basically using the sample code provided in Google’s API documentation. Accordingly, I set a print job name as follows: String jobName = getString(R.string.app_name) + ” Document”; PrintJob printJob = printManager.print(jobName, printAdapter, new PrintAttributes.Builder().build()); My code runs fine and the page is printed […]

Chromium webview does not seems to work with Android applyOverrideConfiguration

Following my change describe in Force locale for Android flavor with resConfig I am facing a problem with webviews containing video. The issue is only on API21+ and really disappear when removing the call to applyOverrideConfiguration. Not so sure how to get around that. java.lang.NullPointerException: Attempt to invoke virtual method ‘int android.graphics.Bitmap.getWidth()’ on a null […]

How to hide scrollbars in Android WebView through React Native

Using WebView in React Native 0.26 and on Android the scroll bars always flash up when the content loads, as we are showing a few on a page this is very distracting. React Native lists ScrollEnabled as iOS only, so is there anyway to hide these scrollbars on Android? Many thanks, Vince

Using shadow-dom (Polymer) in Android 4.4 Webview

I’m actually building a web app using custom Polymer elements (which is based on web-components and shadow-dom) but I encountered a serious problem. I want this app to run on an Android 4.4 WebView, but I experienced some issues with the shadow-dom when testing the app on the WebView, although it works perfectly fine on […]

Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.