I create an android app with Kotlin.The description of the app as the following: a recyclerview horizontal which contains all the list of categories, i use adapter. Then, when i click in item in this list, the list of products belongs appear in the bottom in a recyclerview. The disposition of the product list is done in two ways : either list or grid. the following code is the activity :
My problem is when i click on category, the list of products belong appear, then, when i click on another category, the list of product of the last item appear not the list of product of the category clicked. I think to remove the sharedpreference and still not working. the following code is for sharedpreferences :
How can i make my code functionnal?