How to make Android WebView display partially loaded images? - android

When I display an image in an Android WebView, any image which isn't completely downloaded (including any truncated local file) won't appear at all. Most browsers will display as much of the image as they can, so the image appears gradually instead of just suddenly appearing after several seconds of nothing. How do I get WebView to do this?

Related

SVG image not loading on smartphones unless cached

I have a header SVG image on my website landing page, https://www.csselectronics.com/.
This header image displays correctly on all desktop browser I've tested. However, I've recently found that it sometimes does not display at all when using a smartphone (e.g. iPhone 10, iPhone 11, Android phones).
The image simply is not loaded, though if a manual refresh is done on the page it seems to load correctly. The non-loading can then be re-triggered by clearing the image cache on the phone.
Any idea what might cause this issue?
This was the result of using negative margins on the image div container.

How clicking on a thumbnail image produces a larger image so quickly

I am developing an android app which needs to load a big image quickly. Using Instagram on Android I have noticed a feature they have that I cannot figure out how it works. Instagram users have a feed which displays usually a scroll list with a bunch of small thumbnails:
When you click an thumbnail image you get sent to another page(assuming fragment) that shows a bigger version of the image which appears instantly (to the human eye it looks instant)
You can scroll through all these thumbnails which means a lot of thumbnails display very quickly which I can understand because the images are small and sending over the network would be relatively quick. The problem I am understanding is how the larger images appear so quickly!? When the app downloaded the thumbnails are the larger images downloaded at the same time (I do not think this is the case because it would be such a waste of network traffic since most users on't click on every thumbnail? What technique is being used to have such fast response times for large images? I thought it maybe because of cache, but it happens when I click a picture I have never seen before.I is so fast it looks like it even is not hitting the network.
How clicking on a thumbnail image produces a a larger image so quickly?
Uses faster CDN networks to fetch images
Uses Fresco for image loading which implements progressive image loading
Uses RecyclerView, image loading is triggered when ever you stop scrolling.
Probably uses webp and jpg image formats
Images are cached for later use

Pixel Game in Android

I am making a Game in Android using Android Studio. My Game is beign designed in Pixel Art.
The images that I put on the Game, in the app, are shown with Smooth, they are not pixelated as I have designed.
Is there a way to put the images and show them correctly? Here is an example of what happens. At left, how my App shows the images. At right, how do I need to be shown thw images.
https://stuartspixelgames.files.wordpress.com/2015/10/comparison.png?w=700
What is the supposed size of this image on screen? Perhaps your image file's dimensions are too big sometimes it becomes blur depending also on how you display it.

Android WebView image displayed partly

I have a webview which opens a page that shows different images like a gallery.
The image is saved locally on an sdcard and is loaded through css with background-image: url(file://...).
This issue seems (not sure though) to be connected to Android's request for resources for some reason. The longer the OS needs resources the bigger the white (or black) band is.
This doesn't happen always in one test session and affects images randomly (in a cycle a certain image displays ok, in the next it doesn't). Also it seems to affect only images, displaying an iframe is always loaded normally.
I wouldn't have a problem if this happened for one second and then it would display normally, the problem is that the image stays like that until the next refresh of the webview.
android's version is 4.4.2. It is a mk808b plus device if any of this helps...
Any ideas on how to solve or somehow decrease the times this happens... anything really... except using imageview, I want to keep all in the webview. Any directions to follow for further debugging are also greatly appreciated.
Thank you for any help you can provide.
If it is possible I would try converting background images to a vectorial format (like SVG). Rendering should be easier and less memory hungry.

Android Images have trouble loading after firing off lots of activities?

I have a simple app that displays a series of images and infomation about those images. I've set it up so that when a user touches an image, a new activity is launched and they see more pictures and a longer text description about that image. On that screen, I've also implemented the basic gallery widget that they have here in the Hello Gallery Tutorial.
My problem is that even though I'm drawing on images from the res directory (I've thrown everything in drawable-mdpi thinking that there shouldn't be a huge deal), not all of the images on the gallery portion will load. And I haven't been able to reproduce it 100%, but it seems like the more I play with my phone with this app running (lock screen, unlock screen, go to one image, go back, go to another one, hit home, etc), the more likely any picture that I've got loaded up locally display blank image placeholders, gallery or not (the text comes up fine though).
I'm using a series of imagebuttons, imageviews, and gallery widgets. Play with it enough and eventually they all come as blank, but killing everything through AdvancedTaskKiller brings it back.
Sometimes pictures in my image galleries will also be blank when I first launch my app. That's really weird. I have it set so that the layoutparams are 300 by 200 and I've pulled pictures all over the place to populate my gallery. They should just all scale differently, not fail to load entirely though.
Anybody have any ideas on these?
Try Slow Adapter for the Gallery.
I recommend adopting 1,2,3
It is always hard to work with images. You have to be very careful with recycling memory that your images already used otherwise you could get into different kind of troubles.
Always try to use a good Image loading library that commonly being used by Android developers.
Most commonly used library is https://github.com/nostra13/Android-Universal-Image-Loader
It will optimise your loading.

Categories

Resources