1

I have made a music player and I want to save images for album art. Where should I put all the images: in the Asset folder or somewhere else? The images are in large quantity and I want the images available in the app after publishing it.

I also try to get images through URL with this method

private Bitmap downloadBitmap(final String url) {
        final MediaMetadataRetriever metaRetriever = new MediaMetadataRetriever();
        metaRetriever.setDataSource(url, new HashMap<String, String>());
        try {
            final byte[] art = metaRetriever.getEmbeddedPicture();
            return BitmapFactory.decodeByteArray(art, 0, art.length);
        } catch (Exception e) {
            Log.d("ALBUM ERROR", "Couldn't create album art: " + e.getMessage());
            return null;
        }finally {
            metaRetriever.release();
        }
    }

But the image loading is very slow. This is why I try to save image in the app asset folder, so images are always there if app is publish.

Community
  • 1
  • 1
shakil.k
  • 1,623
  • 5
  • 17
  • 27
  • 1
    Samuh wrote a very comprehensive answer here http://stackoverflow.com/a/2055460/2822762 – Dave Jun 02 '14 at 19:24

2 Answers2

1

You should read through the Offical Documentation on the storage options available, how to access them and which to use.

The assets folder is used to hold files you ship with your app, not files you dynamically create later. Also since you mentioned there will be many images you should be mindful not to waste space on "internal storage" as some (older) devices have very limited internal space available.

I'd suggest you use the "external storage" as you say there are going to be quite a lot of images. I can't see album art files needing to be private either so a public location like this is just fine although you might opt to use private storage to hide the images from the media scanner and all those images showing up in the user's gallery.

Calling it "external" doesn't necessarily mean it is external, such as a removable SD card. Some devices emulate this storage on internal memory. But you should handle the case where is is actually an external hardware location and the user has removed or unmounted the media.

indivisible
  • 4,892
  • 4
  • 31
  • 50
0

If you any experience with server side programming I would recommend you to host a simple server yourself in a cheap host such as DigitalOcean or you can try another easier solution for rest api such as Parse.

I personally really like Digital Ocean because its only $5 a month with 20 GB Storage. The only downside is that you have to be familiar of using the Command Line to host your server :)

Marcus Gabilheri
  • 1,259
  • 1
  • 14
  • 26