Cursor cursor = getContentResolver().query(CallLog.Calls.CONTENT_URI,
    null, null, null, CallLog.Calls.DEFAULT_SORT_ORDER);
  startManagingCursor(cursor);
  SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
    android.R.layout.simple_list_item_1, cursor,
    new String[] { CallLog.Calls.NUMBER },
    new int[] { android.R.id.text1 });
 
  setListAdapter(adapter);
为了在点击item的时候跳转拨打电话 采用以下方式
void getCallLog()
    {
    	cr = getContentResolver().query(CallLog.Calls.CONTENT_URI, null, null, null, CallLog.Calls.DEFAULT_SORT_ORDER);
    	startManagingCursor(cr);
    	
    	ArrayList list = new ArrayList();
    	while (cr.moveToNext()) {
    		HashMap item = new HashMap();
			item.put("number", cr.getString((cr.getColumnIndex(CallLog.Calls.NUMBER))));
			
			list.add(item);
		}
    	SimpleAdapter sa = new SimpleAdapter(MainActivity.this, list, android.R.layout.simple_list_item_1, new String[]{CallLog.Calls.NUMBER}, new int[]{android.R.id.text1});
    	lv_log.setAdapter(sa);
    }




posted on 2012-12-10 20:09  纯洁的坏蛋  阅读(721)  评论(0编辑  收藏  举报