I have this data saved in SQLite database,
The data table is like this:
ID, size, transperancy, style, color
"0", "333","0.44","ST1","red" Note : all values are Strings
If I retrieved the last index column and save it in string colour and displayed it, it shows "red" which is correct. However when I try to use the string colour in if condition like the following code it is not working correctly
Cursor res1 = DB2.getdata();
res1.moveToLast();
size = Integer.parseInt(res1.getString(1));
transperancy =Double.parseDouble(res1.getString(2));
style = res1.getString(3);
colour = res1.getString(4);
Toast co = Toast.makeText(getApplicationContext(), colour, Toast.LENGTH_SHORT);
co.show(); //this toast prints "red"
if(colour=="red"){ **//this condition is not working**
//do some thing
}
Note, the conditions for the size and transparency are working, but only style and colour is not.