I am having an activity which reads outgoing call. I got the numers
and suceessfully shon on my listview . but I am not getting names
releated to that particular outgoing calls.
the whole thing look like this

        Uri allCalls = Uri.parse("content://call_log/calls");
                Cursor c = managedQuery(allCalls, null, null, null, null);
                for (String colName : c.getColumnNames())
                        Log.v(TAG, "Column Name: " + colName);
                System.out.println("IN CURSOR COUNT::" + c.getCount());

                ArrayList<String> valueList = new ArrayList<String>();
        //      ContentResolver cr = getContentResolver();
                //Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, 
null,
                                //null, null, null);
                if (c.moveToFirst()) {

                        do {
                                id = 
c.getString(c.getColumnIndex(CallLog.Calls._ID));
                                num = 
c.getString(c.getColumnIndex(CallLog.Calls.NUMBER));
                                //name =  c.getString(
c.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
                                type = Integer.parseInt(c.getString(c
                                                
.getColumnIndex(CallLog.Calls.TYPE)));
                                 //System.out.println("TYPE::"+name+"\n 
NUMBER"+num);
                                switch (type) {
                                //case Calls.OUTGOING_TYPE:
                                case 2:
                                        Log.v(TAG, id + ", " + num + ": 
OUTGOING");
                                        int count =0;
//                                      names = new String[cur.getCount()];
//                                      if (cur.getCount() > 0) {
//                                              while (cur.moveToNext()) {
//                                                      String id =
cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
//                                                      name =
cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
                                                        
System.out.println("name out going::" + name);
                                                        //names[count]=name;
                                                        valueList.add(num);
                                                        break;
} while (c.moveToNext());
                        ArrayAdapter<String> adapter = new ArrayAdapter<String>(
                                        Outgoing.this, 
android.R.layout.simple_list_item_1,
                                        valueList);
                        setListAdapter(adapter);

I want name if that particular number is stored in mobile database.
If i call to particular no. that particular namename is not coming to
outgoing call listview,instead of that only numbers are coming.

PLEASE tell me soln.

-- 
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