Android lazy images ViewFlipper - android

I have a problem.
I have fragment with ViewFlipper and some string data array (images urls).
How do I do a lazy load of these images and show progressbar until the image is loaded(And caching them if possible)?
Can I use a different view(not ViewFlipper)?
And second question. How do I make a View showing the current image position? Such as a series of white dots with a black under the current picture. If the current image of the first - the first black dot.
Thanks.

Google has a training class answering your first question here. It shows you how to load a bitmap in the background using an AsyncTask and caching it both in memory with an LruCache and on the disk with a DiskLruCache (included in the BitmapFun.zip download found at the link) while displaying a ProgressBar until the image is downloaded
Can I use a different view(not ViewFlipper)?
The aforementioned example uses a ViewPager.
a series of white dots with a black under the current picture.
I do not know if there is such a view available from the Android SDK but this third party widget (Apache 2.0 license) seems to do what you want.
How i can keep link on ImageView and ProgressBar?
I am not sure I understand the question but if you are asking how you go from the ProgressBar (while the image is loading) to the ImageView then the answer is to use a FrameLayout with the ProgressBar and ImageView in it:
<FrameLayout ...>
<ProgressBar ... />
<ImageView
android:id="#+id/imageView"
... />
</FrameLayout>
(see image_detail_fragment.xml in the exercise for more details)
The ImageView will be drawn in front of the ProgressBar but as it will originally have no background and no image it will be transparent and the ProgressBar will be showing.
You then retrieve the ImageView from your code using its id and when you have loaded your image in a Bitmap you use:
imageView.setImageDrawable(loadedImage);
Now that the ImageView has an image it will not be transparent anymore and the ProgressBar will not be showing (you can also add an id to the progress bar if you want to set it to View.GONE to optimise your layout).

Related

Lazyloading like googlenewstand app

I am currently doing a project which needs to load images in a listView with some text from web.I am using universal image loader library,every thing work fine images are loading perfectly without any problem, but my requirement is that if there is no image in a specfic url, i dont want to show that image view in the listview row.which is similer to the news stand app of google.
in the above screen of the newsstand app if there is no image the imageview is not shown and the text will fill to the total width of the cell or row in the listview.How can i achieve this requirement.i have goggled but did not get any right solution or clue to fix this issue,can any one give any snippet or any idea to sort out this issue.
Thank you
In your adapter, when you call the library to display the image, if there is no image url just set the visibility of your ImageView to GONE (and VISIBLE again when there is an url).
If you want to wait that the image is completely loaded to make the ImageView visible, you'll need to register a loading listener. See here.

Loading Sign before downloading Image and Setting Image on Image View

I have a listView in which I have text and an image view Now the data is coming from the service in this case text is of some bytes but due to images size imageview populate after some time . for this I want to show loading symbol in in imageview so that in time of downloading user not say that the app is not able to show images. I have implemented all listActivity and adapters concepts and its working fine but the images take time due to which the imageview part shows black area . any help
Here this I want:
In Android we called it lazy list..
this will help you to understood..
1.Lazy loading of images in ListView
2.http://www.technotalkative.com/android-asynchronous-image-loading-in-listview/
For Image issue :
Change in ImageLoader class (if Using Lazy List)
final int stub_id=R.drawable.ic_launcher; //change it to process image
Good Luck
Place a ProgressBar and keep the imageView over the ProgressBar.So the progress bar is visible when there is no image in the image view. Also use lazyList to load image.
You might want to check out Android Query. it's a library that also supports Asynchronous image loading and caching.
Android

Android Loading Indicator for Downloading Images

I am using an Image Loaded which loads images based on requirment and since the images are big. I want to display an intermediate Spinning Image showing which would convey that the image is loading to the User.
I am displaying these images in the Viewpager.
We can not use a Gif image to display the animation and i wonder how it can be done.
P.S i am not looking for a Progress Dialog.
You could try doing a View Animation on the ImageView. Rotate is one of the included animations, and you can define it in XML.
Here's a Youtube Video from Google explaining it a little more.

How to get all child visible on screen in HorizontalScrollView android

I add many ImageView to HorizontalScrollView, each ImageView load image from internet. But screen only display 3 ImageView.
I want to know what ImageView is on screen because I want to remove image from another ImageView that not display in screen.
Is there anyway to do that ?
Sorry for my bad English.
You need to consider using lazy ListView instead of <ScrollView> for your images. With a lazy ListView, the app won't download the hidden images until the user scroll to view them.
I'm not familiar with such a ListView but I think those links might help you:
Question: How to do a lazy load of images in ListView?
A solution implemented
Project: Android Universal Image Loader

Reverse image load order?

First Question
I use Lazy load of images in ListView to load images in a ListView and a GridView. It works but the images are loaded form bpttom to top. How to fix that?
Bonus Question
Can I use a loading animation in a image view while the real image is loaded? Right now it's just a default image.
In ImageLoader.java you could replace
photoToLoad=photosQueue.photosToLoad.pop();
with
photoToLoad=photosQueue.photosToLoad.get(0);
photosQueue.photosToLoad.remove(photoToLoad);
It will change the order.
To display ProgressBar you can just add it to item.xml. Initially ProgressBar is visible and image is hidden. After bitmap is downloaded you hide ProgressBar and show image. But I would not recommend doing that. While images are being decoded in the background they consume processor power and all your progress bars may be freezing sometimes.

Categories

Resources