I trying to get info in database and sending for an object called Question.
When i got null in database and send it to the field of the object.. I suppose that field will be "null", cause the field is an String.
But i tried all ways to verify it and i cant...
I tried:
Question a = new Question();
a.setAnswer(database.getAnswer(id));
// Way 1
if(a.getAnswer() == null) {
Log.d("Way 1", "successfully");
}
// Way 2
if(a.getAnswer() == "null") {
Log.d("Way 2", "successfully");
}
//Way 3
if(a.getAnswer().equals(null)) {
Log.d("Way 3", "successfully");
}
// Way 4
if(a.getAnswer().equals("")) {
Log.d("Way 4", "successfully");
}
But I didn't got result...
I put in log to log my Question.getAnswer() too:
And here's the result:
D/Here == >: null