I know how I can get all contacts in Android , and how to get their phone number.
What I cant seem to figure out is how to get a contact by phone number...
T
Use this kind of code:
public void logCallLog(String number)
{
long dialed;
String columns[]=new String[] {
CallLog.Calls._ID,
CallLog.Calls.NUMBER,
CallLog.Calls.DATE,
CallLog.Calls.DURATION,
CallLog.Calls.TYPE};
String args[]=new String[1];
args[0]=number;
Cursor c;
c = this.managedQuery(Uri.parse("content://call_log/calls"),
columns, CallLog.Calls.NUMBER+"=?", args, "Calls._ID DESC"); //last record first
while (c.moveToNext())
{
dialed=c.getLong(c.getColumnIndex(CallLog.Calls.DATE));
if(Me.DEBUG)
Log.v("CallLog", "Call to number: "+number+", registered at: "+new Date(dialed).toString());
}
}