So basically I am developing a Task application for android (Java). I want to create a sort feature in my Main Activity which has 4 Buttons All
, High_Priority
, Medium_Priority
, Low_Priority
having an integer value 1,2 and 3 respectively. Now my application stores the data on Firebase Realtime Database in following structure
Firebase Structure:
<USER_ID (UID)>": {
"<Task_id>": {
"checked": false,
"colorCode": "#090808",
"date": "28 Apr 2024",
"description": "",
"Task_id": "-NwZF-mvOfZZOOXi_3NB",
"pointsAwarded": false,
"priority": 1,
"task": "High task",
"time": "12:00 am",
}
Now I get the priority integer from the firebase database in my TaskCardAdapter
using my Model
class and set the task_Priority
textview according to the integer. Now with this I want to sort the tasks on basis of the integer in the TaskRecyclerView
in Main Activity when user clicks on High, Low or Medium button. I want to show only those tasks which have the priority as 1 when user clicks on High_Priority
button and same for Medium and Low.