public ArrayList<SmsUtil.Message> getVerifyData(Context context, int size, int currOffet) { ArrayList<SmsUtil.Message> list = null; Cursor cursor = null; try { ContentResolver cr = context.getContentResolver(); cursor = cr.query(Uri.parse(SmsUris.URI_SMS), null, null, null, "date desc limit " + size + " offset " + currOffet); if (cursor != null) { while (cursor.moveToNext()) { if (list == null) { list = new ArrayList<SmsUtil.Message>(); } list.add(SmsUtil.getMessageFromSmsCursor(cursor)); } } } catch (Exception e) { // 可能会出现没有权限的异常 } finally { if (cursor != null) { cursor.close(); } } return list; }
分批从ContentResolver获取数据
最新推荐文章于 2022-11-24 18:55:49 发布