This is my code, it always falls into the else even when I know that the value going in (via debugger) is empty.
name = cursor.getString(cursor.getColumnIndex("Genus")) + " " + cursor.getString(cursor.getColumnIndex("Species"));
if(name != "" && name != null)
tv.setText(name);
else
tv.setText("Error");
When doing object comparison, you must use Object.equals(Object) method. Using == or != with Objects will only return true if both Objects reference the same thing. That is why you are falling through to the else.
name.equals("") is probably what you want to use.
Also, things would probably work best if you did something like this:
if(name != null && !"".equals(name))
tv.setText(name);
else
tv.setText("Error");