0

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.

Arp
  • 43
  • 2
  • 8
  • 1
    You should prolly use a Image loading library like Picasso or glide – Bhargav Mar 10 '16 at 02:09
  • 1
    `provide by the app` means what? Are you going to load images from `resource` directory or from server? – ELITE Mar 10 '16 at 02:16
  • Thats what I was trying to ask, sorry if not clear. Is it possible to have lots of images in resource directory ? What are the options available to extract/loads images from servers? – Arp Mar 10 '16 at 02:23
  • I added answer. I listed two possible ways. I don't know another possible ways. – ELITE Mar 10 '16 at 02:25
  • So like Instagram? You download photos from a server. Any static images to your app, like menus and button icons, those you keep in the app. – OneCricketeer Mar 10 '16 at 03:00

2 Answers2

0

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.

Community
  • 1
  • 1
ELITE
  • 5,815
  • 3
  • 19
  • 29
  • "But if images size is large, your app size will be accordingly." you mean number of images is large or the size of each individual image? – Arp Mar 10 '16 at 02:30
0

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.

Community
  • 1
  • 1
Stanley Ko
  • 3,383
  • 3
  • 34
  • 60