'How to show most used item in first place in RecyclerView in Android?

I have made the application of different tools which have more than 60 tools I want that the user most used item showed in first place in RecyclerView. Please help me how can I do this thing.

enter image description here



Solution 1:[1]

You can keep a count value for the number of times the user starts the tool from the app. Now you will have a Map with the name of the tool and the count for the number of times it is used. You can use this map to define the order of the list.

Solution 2:[2]

You can do one thing if possible, like when users click on a particular item in RecuclerView then if any API is called on the backend side then from the backend side they can manage hit count(mean how much time particular API calls) at their end and returns count to the frontend on RecyclerView list data. Using that count we can sort the list. This is an approach that I think.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mohit Ajwani
Solution 2 Mehul Kabaria