Android: Let Webview download text only (and work properly) - java

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.

Related

How to enable adding bookmarks in android webview

I am creating a browser app for android and I want know is there any code that helps to enable adding bookmarks in android webview.
This is something you will have to add yourself, a WebView literally just displays html content. It doesn't come with all features like for example Chrome.
To add/save bookmarks you would need to implement a UI for showing the bookmarking button, for entering the URL, for showing a list of previously bookmarked pages etc. Once you have all that you can then get the WebViews current URL by:
webView.getUrl();
and save that to your database.
Then you have the work of displaying a list of saved bookmarks and allowing the users to click them and have the WebView navigate to them.
Here is an example I found (by a simple Google) to help you get started which shows adding a simple bookmarking feature on an WebView: https://www.journaldev.com/15729/android-webview-bookmarks

Browser simulation android

in my app I want to simulate a browser to work in the Background.
What I need is, that the app loads a page in the background fills in a field and clicks on a button.
I searched a little and found appium and selendroid. Now I am not sure if one of those can do what I want, as I want to put it in the Play Store and it seems like both need also a pc to work with.
You can achieve this with a Webview and a Javascript bridge. Appium and Selendroid don't sound like a good match. Docs on integrating webviews here: http://developer.android.com/guide/webapps/webview.html
y dont u just create an http request object in the app instead of loading a browser window in the background?
if all u need is to fill in fields and submit a form, assuming the form is the same every time and u know the api end point u want to hit, it can be easily achieved by simply building the http request in the app and sending it out without loading a url in a browser. Think of it like a post/get request from a rest client.
Let me know if u need more clarification.

Transforming c2kschools.net into an App with Visual Studio

I wish to develop a mobile App that simply makes use of the C2K service for schools website. It has an initial ASPX login page and once logged in, it goes to a personal index.aspx homepage.
What would be the best way to go about this using Visual Studio? I have looked at Apache Cordova but I am not sure about it. Advice on which package to use and what approach I should take to transform this website into an App would be much appreciated.
Thanks in advance.
Ching
I think Cordova in Visual Studio should meet your requirement, you can simply create a blank project index.html and redirect this html to the, e.g. http://www.example.com/login.aspx
After compile, you can run your existing web inside the app.
However, the "LOOKING" of the web site will be changed, since the screen of the phone may be too small to display the content of the entire original web site, you may need to change the appearance of your original web site, otherwise the users may need to zoom-in zoom-out all the time when they browse the web site inside the phone app.

What's the best way to have a button constantly get updated with a content of a web page in Android?

I am new to Android and working on an app that would have a button which would be constantly updated with a content f a web page. The problem is that during downloading of a web page the button is frozen and unclickable. But if I use .post(), to make it asynchronous, I get exceptions. Is there a way to get it working?
Please take a look at the official guide http://developer.android.com/resources/articles/painless-threading.html

Android app loading white screen on device

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);

Categories

Resources