試試這個方法,它應該工作。執行Log.d(tag, "Output here");
來測試你的輸出,但它應該工作。它在這裏。
public void getEvent(String contactId)
{
final String[] projection = new String[] {
Event.CONTACT_ID,
Event.START_DATE,
//Event.TYPE,
Event.LABEL
};
final String filter = Data.MIMETYPE + " = ? AND " + Data.CONTACT_ID + " = ? ";
final String parameters[] = {Event.CONTENT_ITEM_TYPE, contactId};
Cursor cursor = context.getContentResolver().query(Data.CONTENT_URI,
projection,
filter,
parameters,
null);
if(cursor.moveToFirst())
{
for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext())
{
final String contact_id = cursor.getString(cursor.getColumnIndex(Event.CONTACT_ID));
final String startDate = cursor.getString(cursor.getColumnIndex(Event.START_DATE));
//final String type = cursor.getString(cursor.getColumnIndex(Event.TYPE));
final String label = cursor.getString(cursor.getColumnIndex(Event.LABEL));
}
}
}
@dilaraates你在那裏編輯過什麼? – Noundla 2012-08-10 10:52:30
我添加新標籤「光標」:D當您添加與您的問題或代碼相關的標籤時,也許更多的人會對您的問題感興趣。 – dilaraates 2012-08-10 10:55:14
@dilaraates你知道解決方案嗎? – Noundla 2012-08-10 11:01:36