android - Function doing different things when being called the same way -
hello i'm having issue seems line of code ignored or giving different result every time.
private void getcard() { switch (temp4) { case 1: system.out.println("ace"); valuetobestored = 11; break; case 2: system.out.println("ten"); valuetobestored = 10; break; case 3: system.out.println("two"); valuetobestored = 2; break; case 4: system.out.println("three"); valuetobestored = 3; break; case 5: system.out.println("four"); valuetobestored = 4; break; case 6: system.out.println("five"); valuetobestored = 5; break; case 7: system.out.println("six"); valuetobestored = 6; break; case 8: system.out.println("seven"); valuetobestored = 7; break; case 9: system.out.println("eight"); valuetobestored = 8; break; case 10: system.out.println("nine"); valuetobestored = 9; break; case 12: system.out.println("jack"); valuetobestored = 10; break; case 11: system.out.println("queen"); valuetobestored = 10; break; case 13: system.out.println("king"); valuetobestored = 10; break; } { switch (cardtobestored) { case 1: p1card1 = valuetobestored; break; case 2: p1card2 = valuetobestored; break; case 3: p1card3 = valuetobestored; break; case 4: p1card4 = valuetobestored; break; case 5: p1card5 = valuetobestored; break; case 6: p2card1 = valuetobestored; break; case 7: p2card2 = valuetobestored; break; case 8: p2card3 = valuetobestored; break; case 9: p2card4 = valuetobestored; break; case 10: p2card5 = valuetobestored; break; case 11: p3card1 = valuetobestored; break; case 12: p3card2 = valuetobestored; break; case 13: p3card3 = valuetobestored; break; case 14: p3card4 = valuetobestored; break; case 15: p3card5 = valuetobestored; break; case 16: p4card1 = valuetobestored; break; case 17: p4card2 = valuetobestored; break; case 18: p4card3 = valuetobestored; break; case 19: p4card4 = valuetobestored; break; case 20: p4card5 = valuetobestored; break; case 21: p5card1 = valuetobestored; break; case 22: p5card2 = valuetobestored; break; case 23: p5card3 = valuetobestored; break; case 24: p5card4 = valuetobestored; break; case 25: p5card5 = valuetobestored; break; } } system.out.println("card" + cardtobestored + " stored " + valuetobestored); }
temp4 set before getcard() called , cardtobestored. main issue when temp4 11, queen printed in logcat valuetobestored doesn't change 10, instead keeps previous value. ex) getcard() temp->4 valuetobestored = 4 getcard() temp->11 valuetobestored = 4 of other cases work. idea causing this? if need can send entire class file.
Comments
Post a Comment