When the triangle pressed (selected), and then if I press right or left button it will add another triangle on the right or left side of the triangle I pressed.
For example, lets say I clicked the main triangle (ID 100) and then I pressed the Right button, it should add a triangle on my Right, also it must assign a unique address (ID) to the new triangle
*when generating an ID for the triangle it must be 3-digit (from 101-999)
For example, lets say I clicked the main triangle (ID 100) and then I pressed the Left button, it should add a triangle on my Left, also it must have a random 3-digit ID.
Let's say I clicked the main triangle (ID 100) and then I pressed the Left button and the Right button, it should add a triangle on my Left and also my right.
If there is already a left triangle and then the user pressed Left button again, it should not add anything to the left, the same thing on the Right button.
User clicked the triangle (111) then pressed the Left Button
Then User clicked the new triangle (511) and pressed the Right and Left buttons And so on, I hope you got the Idea
How is it possible to make such layout. I thought to do it making many triangle layouts and putting them to single ConstraintLayout
then making them android:visibility="gone"
but how can I make a specific layout visible on click. I'm unable to do it in Java. What should I do??