i would like sort the call logs by cached name. The cached name can be null. So in the case of a null cached name, i would like to have the phone number for an alias.
in sqlite, there is the ifnull() function. ifnull details
I try :
String[] projections = new String[] { Calls._ID, Calls.NUMBER, Calls.DATE, Calls.TYPE, Calls.DURATION, "ifnull("+Calls.CACHED_NAME+","+Calls.NUMBER+") as display_name" };
Cursor cursor_call = ctx.getContentResolver().query(URI_CALL_LOGS,
projections,
null,
null,
null);
But i have an error with my use of ifnull an i don't find a sample of this function.
java.lang.IllegalArgumentException: Invalid column ifnull(name,number) as display_name