android - Looping through elements in an array and displaying in each cardView -
i'm using cardview display data, there total of 5 cards , in each want different card name.
the name displayed beside each cardview. i'm using loop iterate names this:
string [] cardnames = {"a", "b", " c", "d"," e"}; string cardname = null; for(int = 0; < cardnames.length; i++){ cardname = cardnames[i]; }
the loop display each card name looks this:
for(int = 0; < 5; i++;){ "item" + (i + 1) + cardname; }
instead cardviews same name i.e
item 1 //cardname e item 2 //cardname e // , on
how solve this?
are doing this
string [] cardnames = {"a", "b", " c", "d"," e"}; string cardname = null; for(int i=0;i<cardnames.length;i++){ cardname = cardnames[i]; for(int j=0;j<5;j++){ system.out.println("item" + (j + 1) + cardname); } } }
Comments
Post a Comment