Android: JSON string data compare with other string Android: JSON string data compare with other string json json

Android: JSON string data compare with other string


Use .equals() for compare two strings in java/android.

if (json_data.getString("table_name").equals("cars")) {           }

it compare Strings refrence so cant work...

when You use String literal then use ==

and == only for primitive data types and here String is Object So use .equals