Android webView Load in Background - android

I have an app which i want to open a webview
right now i am loading the webview the most simple way
i would like to load the webpage in the background so the user will not have a waiting time
maybe in a service running in the background or in a prevoius activity
i looked around the forums and could not find a refrence to the subject
help will be appriciated.
Thx

You can set the webview's visibility to GONE and load the page and when onPageFinished is fired, you can then show the webview.
Hope this helps.

I hade the same problem a while ago, I know what you want. Asynctask! here is a good link I read on to get it to work!
http://www.brighthub.com/mobile/google-android/articles/82805.aspx
How you get it to work properly.
Load your webview in the doInBackground and perhaps a ProgressDialog that shows that your app i working?
GL mate

you can use asynctaskLoader take a look it's better than the asynctask because it can manage the orientation changed and some other cool things...

Related

Android: get screenshot from hidden WebView every new page redraw

New to Android programming. I need to develop an app getting screenshot of a webpage every time something change inside it. My first way was to extend WebView class and overrite onDraw() call. This allow me to know when web page change by get redraw request and take new screenshot. The problem is, obviously, onDraw is called only if the WebView control is currently visibile on the view but in my case I need to keep it hidden since I want to use only the webkit engine in background and show in the interface only the screenshot of the current page. If I keep hide the WebView no redraw event is delivered. So my question is if there is a way to make what I need? (hope to explained well my problem). Please note, "keep hide" mean I don't put the WebView control inside the layout interface but create separately by using something like "new WebView(this)" at app startup.
Thank you
Just render to a bitmap as these guys did: Converting a view to Bitmap without displaying it in Android?
Override onPageFinished and draw the view in there.

Android Lazy loading without ListView

I am looking to implement lazy loading in my app and I cannot seem to get it done. I've looked everywhere and nothing seems to be working.
My app is a news app making a SQL query to my wordpress website and getting the image URL and the article title associated to the image. The thing is I cannot use list views for this app because I want the first article to be a way bigger image that takes a third of the screen and the title placed on the image (the same way it is done in this image : http://iphone-apple.fr/wp-content/uploads/2010/06/lequipe2-iphone.jpg).
To create the design I have used RelativeLayout. Each article is a RelativeLayout composed of an ImageView and a TextView.
My problem is that all of the tutorials I found on lazy loading for ImageViews on the internet are for ListViews.
I have tried AsyncTask but it did not work. It actually worked but it showed all of the images at the end of the load so I had a black screen for about 5-10 secs before showing the main activity.
Does anyone have any idea how I could proceed ?
Thanks a lot for all of your answers ! :)
May be you are working with Native Emulator that work in slow environment.Install bluestack emulator or try to work on some android device

Android webview loadData

I try to load a HTML page into an Android Webview using loadData function. The issue is that the first time I scroll down the view, it seems like is loading the HTML code.
Is possible to load the HTML site completely before showing the webview?
Otherwise, this first time the view goes slowly down and blink a lot.
I'm getting this webview through a FragmentManager
Thanks in advance.
Try to disable the hardware accelerator on the activity:
android:hardwareAccelerated="false"
This may help :myWebView.setBackgroundColor(Color.TRANSPARENT);

Splash screen during async

I have an android app which does a lot of background processing on launch so for this I've set a content view with an indeterminate progress bar and then during async onprogressupdate I've set the text of the action being carried out. I would like to instead display my own splash screen with again a textview underneath where I can display the current action. I've researched into using surfaceviews and a thread - I'm not sure however if this is the best way to do this. I plan on displaying a sequence of pngs similar to a boot animation which loops until the async finishes.
So my question is: is a surface view class that implements the runnable the best way to accomplish this or is there a better way?
Thank you in advance!
I'm note quite sure about my answer but I guess surfaceview is a more reliable option for this task. If you use several PNGs instead then you need to cache them for memory purposes and this might cause a little problem for your invalidate method in your animation loop.
You could use a transparent activity as your splash screen which would allow you to do pretty much anything you want whilst it was displayed.
Went for AnimationDrawable in the end which was easy to use and worked amazingly. Credit to vmironov for the idea, unfortunately I can't accept a comment as an answer :(

JQTouch android webView configuration

I'm developing an application which is mainly a webview and will display a JQTouch UI. Two of the 3 views work just fine, however, I have a view which loads another page with a form which does not work at all. This view loads up just fine but when I click the link to go to the form the link just stays highlighted and nothing happens. I have overriden all of the methods in webviewclient and webchromeclient and placed breakpoints within with no luck. None of the hooks catch when I click the links.
The part that truly confounds me is that it works in the phones browser but not in my webview. Is there a setting on webview that I may be missing which would make it act like the phones browser?
Any help or suggestions would be appreciated.
The fix for this was to override onLoadResource as the link was being treated as a resource and not a new page load. I tried calling webView.loadUrl right in the override of loadREsource but that caused an endless loop so I had to write some logic to load the url properly into my webView. This seems a bit hacked but it works.

Categories

Resources