Tag: webview

onPageFinished() never called (webview)!

I want to show a toast when the webview is totally loaded. But the toast never show up, i don’t know why..here is my code: public class WebViewSignUp extends Activity{ WebView mWebView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.webviewsignup); mWebView = (WebView) findViewById(R.id.webview); mWebView.getSettings().setJavaScriptEnabled(true); ((TextView)findViewById(R.id.home)).setOnClickListener(new OnClickListener(){ public void onClick(View v) { finish(); } }); […]

How to set text size in WebView in android

I am using WebView to justify text. I want to know- Is it possible to set the text size in layout file? As I want different text size for different screen sizes. And also one problem is first background appears then after 2 second text display. Is it possible to display text immediately? Size of […]

Getting Bitmap from WebView generates OutOfMemory crash

I have a custom WebView and I want to get a bitmap of its content (offscreen included). I used this code, which I got from here: public static Bitmap getBitmapFromWebviewV2(WebView webView) { webView.measure(View.MeasureSpec.makeMeasureSpec( View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED), View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED)); webView.layout(0, 0, webView.getMeasuredWidth(), webView.getMeasuredHeight()); webView.setDrawingCacheEnabled(true); webView.buildDrawingCache(); Bitmap bm = Bitmap.createBitmap(webView.getMeasuredWidth(), webView.getMeasuredHeight(), Bitmap.Config.ARGB_8888); Canvas bigcanvas = new Canvas(bm); Paint […]

How to show Certain Part of WebPage inside Webview With Fit Screen to All Devices

I Want to Show WebPage Inside WebView. Up to this it is fine. But I have WebPage (As Given Below) and I want Certain Part of it. I mean just Top Left Corner should be visible in fit to screen mode in all the devices. I’m resolving this Problem since last two three days. What […]

Android webview geoposition database failed to open

I have website using javascript geolocation api and want it to open in a webview. I set up these permissions in the manifest file: <uses-permission android:name=”android.permission.ACCESS_GPS” /> <uses-permission android:name=”android.permission.ACCESS_ASSISTED_GPS” /> <uses-permission android:name=”android.permission.ACCESS_LOCATION” /> <uses-permission android:name=”android.permission.ACCESS_COARSE_LOCATION”/> <uses-permission android:name=”android.permission.ACCESS_FINE_LOCATION”/> In my activity, I also set webview settings: webview.getSettings().setDatabaseEnabled(true); webview.getSettings().setDomStorageEnabled(true); webview.getSettings().setGeolocationDatabasePath(“/data/data/com.my.app/databases”); webview.getSettings().setGeolocationEnabled(true); And I also handled javascript geolocation […]

Play local Video in webview

I want to play local videos in crosswalk webview. I’m getting the video path from an intent opening my activity, so it could be stored internally or on sd card. Using this url file:///storage/emulated/0/Download/movies/movie.mp4 i get Failed to load resource: net::ERR_ACCESS_DENIED. Using input file dialog with URL.createObjectURL(file); it works. But because i know the path, […]

How to retrieve and modify HTML content from WebView with Http Post

i am developing an android app that shows some part of a HTML page.for the first step i use this code provided in question How to retrieve HTML content from WebView. Full html picture That part i want to show /* An instance of this class will be registered as a JavaScript interface */ class […]

Get href value from anchor tag in Android WebView when link is clicked

I am loading a webpage in WebView. There is a link in the webpage, which on desktop will download the file, but in the app the link should display a Toast saying the link is disabled for the app. I am not sure how to get the value from href of the anchor tag, when […]

HTML scrolling events in an Android WebView that's inside a ScrollView

I have a web page for testing purposes ( https://storage.googleapis.com/htmltestingbucket/nested_scroll_helper.html ) that just prints a counter of the scroll event the html has caught in a fixed header When the Android WebView is the only scroll-able element in the fragment everything is fine and the WebView sends the scroll events to the page If I […]

Is it possible to use content:// as a source for an <audio> element in a WebView

I created a ContentProvider. It exports files within my assets/ directory. I’m using content:// urls to access the exported content in a WebView. The following HTML works as expected: <img src=”content://<provider-name>/test.jpg”> I’m trying to use the content provider for mp3 audio files: <div id=’player’></div> <script> url = “content://<provider-name>/test.mp3”; var audio = document.createElement(‘audio’); audio.src = url; […]

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