Newbie in Android Development. Just looking for suggestions. I want to develop an android app which will display lots of images to user (upon clicks or swipe). In other words user should be able to browse lots of images which are provide by the app (not on the user phone). An example would be existing android app for inspirational quotes etc.
I wonder where all those images would be saved at the developers end? What would be the fastest way to allow user to browse these images? Are there any online example/tutorial for this?
I saw few tutorials but they were only for 5-6 images, but what I need to provide user is 500-1000 images or even more (will be adding if the app is successful).
Any pointers would be highly appreciated.
Possible ways are
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.
resources
directory and load the images. imageview.setImageResource(R.id.image1);
But if images size is large, your app size will be accordingly.
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.
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
int memoryClass = 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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.