Android setting image resource from class inside arraylist -
i apologize if question confusing hard me word. created class holds 2 int , imageview parameters. class added arraylist , shuffled. want access drawable image based on arraylist index. below example of want do.
card card00 = new card(0,0,c0) *the image arraylist<card> deck = new arraylist<deck>(); deck.add(card00); collections.shuffle(deck); arraylist<deck> player_1_hand = new arraylist<domino>(); player_1_hand.add(deck.get(0)); imgview1.setimageresource(player_1_hand.???); //this i'm having trouble public class card { private int x,y; public card (int x, int y, imageview i){ this.x = x; this.y = y; } public int getx(){ return x; } public int gety(){ return y; } public void setx(int x){ this.x = x; } public void sety(int y){ this.y = y; } public void flip(){ int temp; temp = x; x = y; y = temp; }
edit: solved modifying class 3 int.
Comments
Post a Comment