我在收件箱中搜索短信时收到cursor index out of bounds
“请求索引 0:大小为 0”错误。我编写了以下代码:
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Cursor cursor = getContentResolver().query(Uri.parse("content://sms/inbox"), null, null, null, null);
cursor.moveToFirst();
do{
String msgData = "";
for(int idx=0;idx<cursor.getColumnCount();idx++)
{
msgData += " " + cursor.getColumnName(idx) + ":" + cursor.getString(idx);
Toast.makeText(getApplicationContext(), msgData, Toast.LENGTH_LONG).show();
}
}while(cursor.moveToNext());
}
});
}