Comparing String to String Not Working when the String came from SQLiteDatabase

后端 未结 2 629
傲寒
傲寒 2020-12-22 12:54

I\'m retrieving string data from my sqlitedatabase and compare in to my local variable. But its not working. It goes like this codes below.

String hole1 = \"         


        
相关标签:
2条回答
  • 2020-12-22 13:15

    You shouldn't use == to compare strings. Use string1.equals(string2) instead. Using == compares if the reference to each string is equal whereas .equals() compares the values of the strings

    0 讨论(0)
  • 2020-12-22 13:15

    String comp like this would be better

    ().getSelectedItem().toString().equals(hole);
    
    0 讨论(0)
提交回复
热议问题