Fix Cursor warnings
This commit is contained in:
parent
0198c99a1c
commit
1d6e475eb5
|
@ -60,11 +60,11 @@ public class CallLogHelper {
|
|||
try (Cursor cursor = context.getContentResolver()
|
||||
.query(uri, QUERY_PROJECTION, selection, selectionArgs, sortOrder)) {
|
||||
if (cursor != null) {
|
||||
int idIndex = cursor.getColumnIndex(CallLog.Calls._ID);
|
||||
int typeIndex = cursor.getColumnIndex(CallLog.Calls.TYPE);
|
||||
int numberIndex = cursor.getColumnIndex(CallLog.Calls.NUMBER);
|
||||
int dateIndex = cursor.getColumnIndex(CallLog.Calls.DATE);
|
||||
int durationIndex = cursor.getColumnIndex(CallLog.Calls.DURATION);
|
||||
int idIndex = cursor.getColumnIndexOrThrow(CallLog.Calls._ID);
|
||||
int typeIndex = cursor.getColumnIndexOrThrow(CallLog.Calls.TYPE);
|
||||
int numberIndex = cursor.getColumnIndexOrThrow(CallLog.Calls.NUMBER);
|
||||
int dateIndex = cursor.getColumnIndexOrThrow(CallLog.Calls.DATE);
|
||||
int durationIndex = cursor.getColumnIndexOrThrow(CallLog.Calls.DURATION);
|
||||
|
||||
while (cursor.moveToNext()) {
|
||||
long id = cursor.getLong(idIndex);
|
||||
|
|
|
@ -27,9 +27,9 @@ public class ContactsHelper {
|
|||
try (Cursor cursor = resolver.query(uri, PROJECTION, null, null, null)) {
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
ContactItem contact = new ContactItem(
|
||||
cursor.getLong(cursor.getColumnIndex(
|
||||
cursor.getLong(cursor.getColumnIndexOrThrow(
|
||||
ContactsContract.Contacts._ID)),
|
||||
cursor.getString(cursor.getColumnIndex(
|
||||
cursor.getString(cursor.getColumnIndexOrThrow(
|
||||
ContactsContract.Contacts.DISPLAY_NAME))
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue