Hi ,

my problem solved with following code.and just define  <uses-permission
android:name="android.
permission.READ_CONTACTS" /
> in android manifest.


private void readCallLogs()
    {
        try
        {
            long dialed;
            String columns[]=new String[] {
                    CallLog.Calls._ID,
                    CallLog.Calls.NUMBER,
                    CallLog.Calls.DATE,
                    CallLog.Calls.DURATION,
                    CallLog.Calls.TYPE};
            Cursor c;
            String strOrder = android.provider.CallLog.Calls.DATE + " DESC";
            c =
getContentResolver().query(Uri.parse("content://call_log/calls"),
                    columns, null, null,strOrder); //last record first
            while (c.moveToNext())
            {

dialed=c.getLong(c.getColumnIndex(CallLog.Calls.DATE));

Log.i("-----Number-------",""+c.getString(c.getColumnIndex(CallLog.Calls.NUMBER)));
            }


        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to