0

I am using the search manager of android to display data from my server when typing in the searchView. The problem is when displaying images in The SUGGEST_COLUMN_ICON_1 it blocks the application and I can't find how to make them download in background and get the result to update the cursor.

  • I already created a ContentProvider
  • Declare it in manifest.xml
  • Configured the searchable.xml
  • Displayed data

I'm only having problem with images. They took a while to be displayed. Any Solutions?

Brijesh Kumar
  • 1,685
  • 2
  • 17
  • 28

2 Answers2

0

I can't find how to make them download in background

you can use third party libraries for this purpose such as glide and picasso.

they take image url and download it in background and show them on UI thread and you can configure them to match your needs

Farid
  • 1,024
  • 9
  • 16
  • I'm already using Glide, the problem is that I had to download the image and then get it as a file from the cache because SUGGEST_COLUMN_ICON_1 is a predefined resource in android and it only 3 formats available for displaying the image – Oussema Smaoui Oct 25 '16 at 14:47
  • a local file or a content uri or a local resource, it can't be shown directly from the URL – Oussema Smaoui Oct 25 '16 at 14:49
0

I just figured out that I don't need the content provider for my app, so I removed it, and I just used the OnQueryTextListener on the SearchView with a custom adapter for suggestions. So everything works fine now, instant search with asynchronous images show.

This answer helped me

enter image description here

Community
  • 1
  • 1