Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Best approach in my eyes would be to download the image files as normal image files via a HTTP get request. Make sure it is threaded of course, and have a thread pool that you can queue up requests into, and have 2-3 threads go through and download.</p> <p>In terms of saving them, I would personally move away from saving to blob in a database, and opt to save them to the persisted storage in your application's private directory. Saving the image files with their filename as their id in the database you have created will be much quicker for loading them back in. </p> <p>You can also hold a reference to the ImageView, and have it display a place-holder initially, with a successful HTTP request replacing the bitmap of the ImageView with the one you have just downloaded/read in from storage.</p> <p>You can also do some image caching within the HTTP request you make.</p> <pre><code>ImageView myImageView = findViewById(R.id.testImage); URL url = new URL("http://www.website.com/image.jpg"); URLConnection connection = url.openConnection(); connection.setUseCaches(true); Object response = connection.getContent(); if (response instanceof Bitmap) { Bitmap bitmap = (Bitmap)response; myImageView.setBitmap(bitmap); } </code></pre> <p>It also may be helpful to lookup the uses of the LRUCache, which performs a lot of caching functionality for you.</p> <p>Check out <a href="http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html" rel="nofollow">this link at the Android Developer site</a> for a good in depth guide to image caching</p> <p><strong>Edit:</strong> You can use the advice in Robert Rowntree's answer to load bitmaps more efficiently to cut down on your memory use as well. The link provided details loading of bitmaps using less memory, something that would work well if you are creating thumbnails from larger images downloaded over the web and saved off to local storage.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload