1

I retrieve data from mysql server and one of the fields is an int value (1 or 0 ) and it's printed right (1 or zero ) but when I try to apply an if condition on this variable for example :

 if (currentCourse.getForFreeStr() !=0)forFree.setVisibility(View.GONE);
 the condition always give the result for != 0 

I also tried to take the value as a String and put make the condition :

  if (currentCourse.getForFreeStr() !="0")forFree.setVisibility(View.GONE);

it does the same please tell me what is wrong . note : when I use the same codes on the data retrieved from a similar table in another database it works fine !

VLAZ
  • 26,331
  • 9
  • 49
  • 67
Sad Being
  • 23
  • 3
  • post your json data and CurrentCourse model class – Bhuvanesh BS Aug 15 '17 at 22:19
  • 1
    try using if (!currentCourse.getForFreeStr().Equals("0")) to compare the contents of the strings rather than comparing references. For more information on this see: https://stackoverflow.com/questions/814878/c-sharp-difference-between-and-equals – CodexNZ Aug 15 '17 at 22:35
  • 1
    Thanks for your answers I will try it and tell you if it worked – Sad Being Aug 17 '17 at 11:21

0 Answers0