diff --git a/app/build.gradle b/app/build.gradle index dfbc1f5..3f80554 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,8 +9,8 @@ android { applicationId "website.julianrosser.birthdays" minSdkVersion 11 targetSdkVersion 23 - versionCode 240 - versionName "2.4" + versionCode 241 + versionName "2.4.1" } buildTypes { diff --git a/app/src/main/java/website/julianrosser/birthdays/fragments/ImportContactFragment.java b/app/src/main/java/website/julianrosser/birthdays/fragments/ImportContactFragment.java index ba072e6..f3e8e77 100644 --- a/app/src/main/java/website/julianrosser/birthdays/fragments/ImportContactFragment.java +++ b/app/src/main/java/website/julianrosser/birthdays/fragments/ImportContactFragment.java @@ -130,7 +130,9 @@ private ArrayList loadContacts() { String name = cur.getString( cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME)); ContentResolver bd = getActivity().getContentResolver(); - Cursor bdc = bd.query(android.provider.ContactsContract.Data.CONTENT_URI, new String[] { ContactsContract.CommonDataKinds.Event.DATA }, android.provider.ContactsContract.Data.CONTACT_ID+" = "+id+" AND "+ ContactsContract.Contacts.Data.MIMETYPE+" = '"+ ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE+"' AND "+ ContactsContract.CommonDataKinds.Event.TYPE+" = "+ ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY, null, android.provider.ContactsContract.Data.DISPLAY_NAME); + Cursor bdc = bd.query(android.provider.ContactsContract.Data.CONTENT_URI, + new String[] { ContactsContract.CommonDataKinds.Event.DATA }, + android.provider.ContactsContract.Data.CONTACT_ID+" = "+id+" AND "+ ContactsContract.Contacts.Data.MIMETYPE+" = '"+ ContactsContract.CommonDataKinds.Event.CONTENT_ITEM_TYPE+"' AND "+ ContactsContract.CommonDataKinds.Event.TYPE+" = "+ ContactsContract.CommonDataKinds.Event.TYPE_BIRTHDAY, null, android.provider.ContactsContract.Data.DISPLAY_NAME); if (bdc != null && bdc.getCount() > 0) { while (bdc.moveToNext()) { String birthday = bdc.getString(0); @@ -139,6 +141,8 @@ private ArrayList loadContacts() { Contact con = new Contact(name, birthday); contactsList.add(con); } + } + if (bdc != null) { bdc.close(); } }