I've debugged my app on my PC and it works fine. When I go into my phone and tablet instead of it loading the WebView like it should it simply loads a white screen, I guess failing to load the web site. I'm not sure where to begin debugging since my debug mode and virtual device works fine. Any suggestions?
A couple of suggestions based on these issues:
Make sure you have permissions on your devices in the Manifest file:
Make sure your devices actually have internet access
Possibly enable javascript (i.e. mWebView.getSettings().setJavaScriptEnabled(true))
Try loading a different URL (i.e. http://google.com) to see if that loads
Try changing the background color to see if your content is loading, but you can't see it (i.e. mWebView.setBackgroundColor(Color.parseColor("#000000"));)
The fact that it's working locally but not on device suggests either connection issues or permissions in my opinion. The other option is that the html you're loading is corrupt and the browser on your device(s) are breaking on rendering them.
Android WebView shows a blank page
Does your WebView require JavaScript? If so you'll need to enable it.
webView.getSettings().setJavaScriptEnabled(true);
Related
So, this peccadillo has lingered for too long in my application but there doesn't seems to be any advice related to the problem I face.
I made an Android application which works as an online folder browsing mechanism by showing content in form of folder/file icons and text using a Custom Gridview. The problem I face is only occurs for once and not the second time when I replicate the same process.
The process is of asking for a permission to access the external storage and after use denies or accept it, the screen turns a bit of a semi-transparent layer of black and goes away after I close the application. It only happens in the Activity where GridView is used as a part of the whole layout. Obviously it wouldn't pop up the second time when I accept the permission but when I deny the permission and replicate the same process, the issue doesn't happen again once it's occurred but I'd like to assess what could be behind this weirdness.
I want to use webview to render a login page. Thr webview is hidden in my app. Once the app is finished there will be some actions performed to login. (Since this is not a normal form, I really need to use WebView). But the big images on this site consume much bandwidth and the login takes longer. How can I disable the download of them and still get no errors in webview?
You can stop loading the images in webview.
webView.getSettings().setLoadsImagesAutomatically(false);
https://github.com/delight-im/Android-AdvancedWebView
Use this Github Library
it may be helped a lot.
I am looking into the AOSP source code to see how WebViews are implemented. As far as I know, with Android 6, WebView is now a separate application of its own (called Android System Webview). However, in the external/chromium-webview folder I only have the apk files.
I found frameworks/base/core/java/webkit/WebView.java, which seems to be the WebView implementation, but I don't quite understand if this is the real implementation or just a stub. Is it this one, or the source code on chromium website that actually is the Android System WebView?
Also, how is it that an Android app can use the Android System Webview app to create a Webview in itself? How are they connected?
Finally, in the folder where I have webview.apk, readme mentions libwebviewchromium.so. What is that?
Thanks very much in advance.
I guess chromium is a separate project. They are building the apk and putting it in AOSP.
You should refer here-https://www.chromium.org/developers/how-tos/build-instructions-android-webview
I ASSUME Web view is just a view...all the logic, parsing of html and other stuff is there in separate app...webview just binds to other app for all the logic...
I am trying to set up FacebookSDK in my app. (Added it as a library, so on, so on). I'm not sure why but after logging in, my profile picture and app picture isn't showing up.
The first picture is one where I've manually copied over all source files from facebookSDK and the second is of facebookSDK as a library. I'm not sure where to even begin looking for this bug as it seems that facebook login page is just a webview returned by facebook itself.
Thanks for any help.
Did you try logging in using different test users? Read about it here: Test Users
See if the problem still exists.
I want to save as an image which is on android mobile screen at 10 sec time interval. Which may be home screen or menu screen or any thing. Can anybody tell me how i can achieve this?
I got success for my own application but its not capturing menu screen as an image.
Unfortunately, on most devices it's not possible to get the snapshot of the device outside your application. This, obviously, for security reasons.
This could be achieved accessing the frame buffer at /dev/graphics/fb0, but normally you don't have the permissions to read that.
You need to have a root access to achieve this. Write a background service and execute "/system/bin/screencap" to get the screenshot. Check this answer to find out how to get screenshot and store in sdcard.
Alternatively you can use Android Screenshot library to get screenshots on a non-rooted phones but it requires your phone to be connected to your desktop using ADB.