Load multiple images with Glide on Android - android

I want to make a simple gallery app on Android (like Google Photo or any standard gallery app). I've read that the best way to load images is use Glide library (Google recommends to use it). But how can I load multiple images (from sdcard) using Glide? I can use Glide.with(ctx).load(File file)... for loading single image, but I dont know how to load multiple. And what library does Google Photo uses (it works really great both with local and with cloud images)?

So, the only one way to load images with Glide is to load them one by one using Glide.with(ctx).load(File file)...
But it's not a problem to use it even if we have a lot of images - it works perfectly. And it seems that Google Photo app for Android uses Glide, that's why Google recommend using it.

Related

How to load images from internet in android app quickly?

I'm a beginner in android and i want to load some images from internet in my app. I heard about libraries such as Glide and Picasso. Can anyone please tell me which library is the best.
In your title you use the word "quickly". Theres no such thing, unless you have a cache implementation. As you pointed out those two libraries help in retrieving images from the web and displaying them into imageView, also support cache features so that images previously displayed can load faster in the near future.
Simple example of Picasso:
Picasso.get().load("http://i.imgur.com/DvpvklR.png").into(imageView);
Want to know more about cache in Picasso? Check out this answer
According to this article here both are really nice to be used , but I would suggest Picasso because it just updated to 3.0 + it is lighter than Glide when it comes to :
library size and method count .

Android I want to stream images from online database

I am new to Android so I want to create a background wallpaper app. I made the offline version already which displays images from an array using ImageAdapter.
But I want make it online so that the images will be downloaded and displayed from an online database. What would be the simple and best way to do it? An example would be preferred.
You can use Picasso library. Image loading using Picasso is very easy, you can do it like this way
Picasso.with(context).load("http://i.imgur.com/DvpvklR.png").into(imageView);
and in their website you can get every details.
and another Library is Glide. You can use Glide too for loading image..
Just use Picasso, it's pretty simple and lightweight library with good documentation. You also can save images from network with some hacks.
http://square.github.io/picasso/

Using Fresco + S3 in Android

I need a way to show several ( maybe 20-30 ) images on screen on an Android application i'm working on.
Considerations:
My images are stored in AWS S3.
The list that displays these images is implemented using RecyclerView.
After some research, i've decided to use Fresco to show and cache these images, but now i realize that i need a Uri from said S3 images.
How can i accomplish this?
Maybe using the newer TransferObserver.download(); and just display the images is better? But again, caching and recycling gets in the way.
Is there something super obvious im missing?
I've tried to use the link given at the S3 GUI but i get access denied, of course. I haven't made these images public because of security reasons.
Fresco does support content provider URIs. So you could write your own content provider that in turn wraps an Amazon TransferObserver.

Is better optimize the image in server or in local?

So i´m creating a app in Android which stores images in a external server. I want to know where is better to make the optimization of the image file, in server, or give the non-optimize image to local and then optimize inside the app. Im using mysql for store the images, but if its better to use sqlite server i will change it. Thanks.
The best thing to do here is create an application on your server exposed through an API with query parameters to specify image sizes + caching mechanism.
For example:
www.mywebsite.com/imageloader/file-identifier?width=50&height=50&format=png
then implement a caching mechanism take a look at (https://dev.mysql.com/doc/refman/5.1/en/ha-memcached.html) for mysql on the server for this image using these parameters so the application can quickly return this file each time and not require too much work from the application. This will allow you to request multiple images at specific sizes when you need them for example only as a thumbnail... Or a full Gallery image which can be something much larger.
Additionally you will want to use an Image Library and there are certainly quite a few for Android (to name a few):
Picasso from Square http://square.github.io/picasso/
Fresco from Facebook https://github.com/facebook/fresco
Ion from this Github https://github.com/koush/ion
These can all help you format your images and cache them locally and even downsize the images as necessary.

How ca I use an Image for entire application without downloading again

In my Android application I have to fetch some images from the server and show them.Same image is shown in some of the pages.Now I am downloading the same image in each page and getting out of memory error.How can I reuse the one that I have downloaded earlier in each page
Use Android Query, and then Image Loading in particular. It's really easy and performs well.

Categories

Resources