0

In my search suggestions drop down in my app, I want to display a thumbnail next to the search suggestion (like Google Play does). This thumbnail will be downloaded from the internet. Currently, I am downloading the image as a bitmap, multiplying its dimensions by an guessed number, saving it as a JPEG, and then using the URI of the saved image to display in the search suggestion. Then, this for adding the suggestion to my list of search suggestions in the ContentProvider class: String[] row = {String.valueOf(i), imageUri.toString(), title, title}; cursor.addRow(row);

THERE HAS TO BE A BETTER WAY OF DOING THIS. It is slow, and I usually run out of memory resizing all those bitmaps.

How can I "simply" get the image from URL and set it as the SUGGEST_COLUMN_ICON_1 in the search suggestion?

Eric Cochran
  • 8,414
  • 5
  • 50
  • 91
  • 1
    Search suggestions are computed as the user types (i.e., after every character) so you shouldn't be doing any long running operations (such as network operations) during the query. – ianhanniballake Jan 13 '14 at 17:14
  • No network operations during the query? Then, how do I get the images to display? I cannot download every image from the network and then query those. Any advice? – Eric Cochran Jan 13 '14 at 17:52
  • Also, Google Play does it, so it must be possible somehow. – Eric Cochran Jan 13 '14 at 17:58
  • So, for now, I am just loading the first image in the results. That keeps it a little faster, and that is pretty much what Google Play does. – Eric Cochran Jan 13 '14 at 20:35

0 Answers0