B
B
branchapp2020-05-06 23:30:47
Android
branchapp, 2020-05-06 23:30:47

CardView and programmatic creation of the element, where to find information?

Good evening everyone.

Preface.

I must say right away that I was engaged in Web development and, in general, looking at the code, I understand what is happening there, that is, to distinguish between a variable, a function, an algorithm, etc. etc. can. Now I'm studying Android development and I don't fully understand certain aspects of Android development specifically. Before writing the question, I spent a week (about 3 hours after work :-D) trying to find the necessary information, and found examples with the programmatic creation of Buttons (Buttom), and understood something. Since I want to figure it out and learn myself, help lies in the source of information with a solution to a similar problem. Read the issue below. Thank you for reading this section. :-D

The crux of the matter.

I will describe a kind of algorithm:
1. Activity has FAB on it.
2. When you click on FAB, a Pop-up window is created, where there are two TextViews, one is responsible for the title and the other for the description. And two buttons "OK" and "Cancel".
3. When you click on "OK" --- Get access to the variable GraphCount = 0 --- Generate the variable GraphCardID = Graph + N, Where N is the value of the GrapCount variable --- Then GraphCount++ --- Write the values ​​of the variables GraphTitle and GraphDescription from TextView fields.
4. We create a Card on the Activity where the Name and Description are displayed, and an ID is also assigned. I need the ID so that when the user clicks on the card, a transition to another Activity will be made and at the start of the next Activity, it would be possible to determine which data array to display on it.

The problem, or rather I can not understand:
I cannot understand how I can actually implement the creation of this card, how to assign values ​​​​to the variables displayed on the card, I understand. It turns out that I need the GraphCard.xml file, the actual markup of this card. In Activity I should have a RecyclerView. And I need an Adapter that will actually add all this. I have not figured this out yet, please help with information. Thank you very much in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question