2

Scenario

I needed to introduce a search or filter in my android application on the basis of some Tags. I have a Json response coming from some Retrofit calls in a Staggered Grid view.

Questions

  • What would be good approach to do it? Instant Search? If yes, then How can i achieve it?
  • I am fetching data in Json and saving it into Model class. Can I take help from Model class to implement Search?
  • How can retrofit help me in searching?
  • Any other concerns?

Any help would be appreciable :)

Edit-1

Elaborating more:

  • I do have a Json response coming from Retrofit request.
  • Sample of json:

    {"Value":2,"tags":["workout","game"]}
    {"Value":2,"tags":["game","person"]}
    
  • There are a lot of data coming from the Json which I am not pasting here. I am loading above Json in Recycler Staggered Grid View.

  • I do have a Search bar where user will put multiple Tags like game, Person.

  • This search will fetch Values associated with given Tags in search box.

Amit Pal
  • 10,604
  • 26
  • 80
  • 160

2 Answers2

0

Instant serach can be implemented with the help of AutoCompleteTextView.

you can follow this and this links-

Maybe you can save your tags in database and you can pop out tags as a List and attach this to adapter and rest of the work AutoCompleteTextView will take care of.

Or you can use SearchView. You can customize it also according to your needs.

Community
  • 1
  • 1
RajSharma
  • 1,941
  • 3
  • 21
  • 34
  • Isn't `AutoCompleteTextView` is completely different approach from Search? AutoCompleteTextView will help me when User don't know the exact name of tags. But In my case User already knew about the tags what they have to fetch other data associated to these tags – Amit Pal Oct 21 '15 at 04:40
  • Could you please ellaborate what kind of search feature you want in your app? – RajSharma Oct 21 '15 at 04:42
-1

It is better to use Fragment.Fragment makes easy to your requirement.

sunil
  • 1
  • 1