0

I have just created a basic search activity with Recent Query Suggestions using these 2 links however, i have a question in order for me to finish this.

I did a test where i searched a, then b, then c and all the way up to z and i noticed that when the search view focuses it shows all 26 of your recent search suggestions.

I don't feel that is necessary since most of the time the user already knows what they are looking for and therefore will be highly unlikely to scroll down all of their suggestions for what they've typed before.

I want to have a maximum of 10 search suggestions shown.

This is a duplicate question for this other stack overflow question however at the time of posting this question, the question in the link lacks an answer.

How do i limit the number of Recent Query Suggestions shown to 10 in Kotlin?

Jevon
  • 295
  • 2
  • 13
  • If you post some of your code, people will more likely respond with an aswer suitable to your question. I can't give you a qualitfied answer, since I know NOTHING about your implementation! – Neo Nov 09 '20 at 09:46

1 Answers1

0

Hi you can use truncateHistory method in order to limit suggestion list

  • 1
    Good answer but please provide some code, that would be more convenient. – Jevon Nov 08 '20 at 21:12
  • Looking at the link, it looks like it limits the amount that can be saved in your history as apposed to the amount of suggestions shown? – Jevon Nov 08 '20 at 21:24
  • What are you going to do with the records which you won't show to user? Is there any reason to store? – Rustam Samandarov Nov 08 '20 at 21:25