Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

How to reset the content of recycler view using Kotlin

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I create an android app withg kotlin, in one of my interface, i create three recyclerview.One for type, the second for category and the last one for product.
For the first click on item in a recyclerviewType, the categorie display then when i click on category the list of product belong appear, but when i click on other item in recyclerviewtype, the category item change but the product still exsite.
So, how can i clear or reset the recyclerview of Product with kotlin.
Screenshot_2019-07-19-09-29-26.png
[Thumbnail for Screenshot_2019-07-19-09-29-26.png]
the correct one
Screenshot_2019-07-19-09-29-18.png
[Thumbnail for Screenshot_2019-07-19-09-29-18.png]
the problem is here how can i clear the product grid
 
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We need to see your code. Are you using Glide to display the image?
 
Maha Sakka
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Randy Tong
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you debug the product value? Are you getting the correct product value?
 
Maha Sakka
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, evrey thing is correct, my problem is when i click on another item merchant type, the list of product of last merchant still existe
 
Randy Tong
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Show us class adapter code as well.
 
Maha Sakka
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code for categoryname adapter :

the second one, the product adapter :


 
Randy Tong
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Maha Sakka wrote:yes, evrey thing is correct, my problem is when i click on another item merchant type, the list of product of last merchant still existe


How you know everything is correct? Did you use log to check the value of price and image file url ?
If they are displayed correctly but the item shown in product adapter is not you expected , I guess the issue is because of Glide.

You may need to clear the cache in Glide.
 
Maha Sakka
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Randy Tong wrote:
I guess the issue is because of Glide.
You may need to clear the cache in Glide.


So, how can i clear the cache in glide ?
 
Randy Tong
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry,  should be Picasso, not Glide.

Try this
 
Randy Tong
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
deleted.
 
Maha Sakka
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where should i add this piece of code ?
 
Randy Tong
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Replace this line
 
Maha Sakka
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried what you said but still the same problem
 
Randy Tong
Ranch Foreman
Posts: 376
4
Android Tomcat Server Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you use log to check the value of price and image file url ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!