-1

You can see 2nd 'values.put' and 3rd 'values.put' insert no values. I want to check it in MainActivity.java. Like this. if it's same with "" then I will Log null, otherwise, Log not null. But if I check like that, Log not null!! why? and how can i know 2nd values same "" ?

    arr = sqlite.select();

    if(arr[1] == ""){
        Log.d("check", "null");
    }else Log.d("check", "not null");

$

    public void insertId(String myId) {

    //helper = new DBHelper(ForSQLite.this, "Info.db", null, 1);

    db = helper.getWritableDatabase();

    db.delete("info", null, null);

    ContentValues values = new ContentValues();
    values.put("myId", myId);
    values.put("targetId", "");
    values.put("message", "");
    db.insert("info", null, values);
}

1 Answers1

1

When comparing strings in Java, use .equals() instead of ==

wvdz
  • 16,251
  • 4
  • 53
  • 90