IS NOT NULL is still returning null values in my query

877 Views Asked by At

I am using Loader for a query using CursorLoader and the appropriate parameters to derive values.

I am using a recyclerview to display data.

Without the use of IS NOT NULL in my SELECTION parameter, which is the same as a WHERE clause my recylerview shows 2 blank rows. When I add IS NOT NULL in my selection clause, one blank row is removed and one still remains.

below is my simple SELECTION CLAUSE

    String SELECTION = ContactsContract.CommonDataKinds.StructuredPostal.CITY + " IS NOT NULL ";

    switch (id) {
        case LOADER_ID:
            return new CursorLoader(
                    getContext(),
                    ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_URI,
                    FROM_COLUMNS,
                    SELECTION ,
                    null,
                    ContactsContract.CommonDataKinds.StructuredPostal.CITY + " ASC"
            );
1

There are 1 best solutions below

1
NVA On

I used "<> ''" instead of IS NOT NULL