getContentResolver().query selection args

Put your problem here if it does not fit any of the other categories.

getContentResolver().query selection args

Postby ting-tong » Mon Mar 07, 2011 1:37 pm

Hi, new to the forum, I hope it's the right place to post this. :D

I am trying to get data from the CallLog content provier. I am able to do the basic stuffs but stuck at the moment with the query. Here's the code I am using. This works perfectly and returns the call log of all incoming call. However, If i want to get the incoming call log for a particular number, I am not able to query it correctly? Is it possible to specify multiple selection args in the query to specify that I need CallLog.Calls.INCOMING_TYPE and would supply a number for CallLog.Calls.NUMBER at runtime. I have tried several queries but must be doing something wrong (syntax?). Any help with this guys? Thanks a lot.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. Cursor c = getContentResolver().query(CallLog.Calls.CONTENT_URI, null,
  2.                     CallLog.Calls.TYPE + "=?",
  3.                     new String[] { String.valueOf(CallLog.Calls.INCOMING_TYPE) },
  4.                     ORDER_BY);
Parsed in 0.011 seconds, using GeSHi
Posts: 2
Joined: Mon Dec 27, 2010 11:16 pm


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 5 guests