Inflate programmatically for android layout



I want to reuse existing layout again and again instead of creating/writing new xml. Currently, I have like this.


enter image description here


I want to have like this programmatically instead of writing in xml (may be I want to write it in Activity).


enter image description here


May I know how to do? Also, another problem is that if I reuse like that, "id" will be same. If so, how can I set text?


enter image description here


No comments:

Post a Comment