Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

java.lang.IllegalStateException: cardProductItem must not be null

Ranch Hand
Posts: 179
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have create an android app with Kotlin.This app contains an interface, which contains a recyclerview to get all the list of product.
To fill this list of product, i create an adapter, this adapter is a cardview : Imageview and two textview.
In this interface, i added two buttons, one when i click on all the product display with the list and the other one display with grid disposition.The default value for grid disposition.
I wsant to change the width and the height of a cardview, to display all the product in the List.
The following code is anadapter item:

the following code is an extract from an xml file which cotains a recyclerview :

the following code contains the onclick acion into the two buttom(Imageview) :

after running my app an exception appear as the following :

could you please tell me where's the error and how can i correct it
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic