-1

I want to create some CardView items dynamically, depending on items I get via a REST call. I created a CardView XML layout that contains many single elements with many settings. I don't want to write this XML layout in code to create it dynamically. Is there an easy way to do this work?

Each CardView item has its own name etc. therefore, the IDs of the elements inside the CardView must be different.

laprof
  • 1,246
  • 3
  • 14
  • 27

1 Answers1

3

I think it would be a good idea that you take a look at this tutorial. https://guides.codepath.com/android/using-the-recyclerview

Basically what you want to do is create a basic CardView item, with its correspondent ViewHolder and inflate the contents of each item when you get the result from the API call.

Cesar
  • 682
  • 3
  • 15