Any of those help 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.
it should still fix some issue You have not positioned your Cursor on a row. Initially, it is at position -1. Presumably, given your existing code, you should call moveToFirst() on the Cursor after the null check and before your getString() calls.