Skip to content
Advertisement

Combining Retrofit2 with JSON inside an Adapter with a Different Number of Items

I am trying to get some data from a rest API, but I have a problem because I have some objects with a different numbers of items.

For example:

JavaScript

They have the same key, but the problem is in some objects, one or more arguments can be missing.

My app starts running, but when I try to scroll down it crashes. I have am receiving this error:

JavaScript

Here is my MainActivity and ListView:

JavaScript

This is the Adapter class:

JavaScript

I would appreciate any help.

Advertisement

Answer

To store the holder so that it can be retrieved when getView() is called again:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement