大家好,当我阅读 CallLog 时,我遇到了一个问题,数字的值为 0,例如,当我阅读缓存的名称时,它的 2 是我的代码,我输入了权限
String[] fields = {
android.provider.CallLog.Calls.NUMBER,
android.provider.CallLog.Calls.TYPE,
android.provider.CallLog.Calls.CACHED_NAME,
android.provider.CallLog.Calls.CACHED_NUMBER_TYPE
};
String order = android.provider.CallLog.Calls.DATE + " DESC";
Cursor c = getContentResolver().query(
android.provider.CallLog.Calls.CONTENT_URI,
fields,
null,
null,
order
);
if(c.moveToFirst()){
do{
//the problem was here //System.out.println(c.getColumnIndex(android.provider.CallLog.Calls.NUMBER)+" - - ");
//the solution is :$
System.out.println(c.getString(c.getColumnIndex(android.provider.CallLog.Calls.NUMBER))+" - - ");
} while (c.moveToNext());
}
我已经阅读了关于stackoverflow的所有相关问题我想通了所以如果有人遇到这个问题我会保留这个问题我被转储了:S