Android Programming Working With Lots Of Images
Solution 1:
Possible ways are
- To store those images on server and load it from Server URL.
And you can use Picasso to load those images with following code
com.squareup.picasso.Picasso.with(context).
load(imaegPath).
placeholder(R.mipmap.ic_launcher).
into(imageView);
here imagePath
is the URL of image.
For more details on Picasso
read this answer
But for that you need internet connection.
NOTE : This may not be the fastest way to load images as it depends on internet connection.
- You can store images in
resources
directory and load the images.imageview.setImageResource(R.id.image1);
But if images size is large, your app size will be accordingly.
Solution 2:
It seems that you need large size of memory, and strategy for control that.
First, I suggest you to get your memory class. memoryClass shows you how much memory your app can use. With this value, you can determine your image cache amount.
ActivityManageram= (ActivityManager) getSystemService(ACTIVITY_SERVICE);
intmemoryClass= am.getMemoryClass();
Log.v("onCreate", "memoryClass:" + Integer.toString(memoryClass));
See Also: Detect application heap size in Android
Second, ImageView of Android 2.2 and 2.3 has memory leak. (Well, these versions are now very old and hard to find)
Android bitmap imageview memory leak
You can download this example: https://github.com/StanleyKou/GettyImageViewer In this example, you can see how to use picasso library with many images from website.
Post a Comment for "Android Programming Working With Lots Of Images"