/android/export-contacts

To get this branch, use:
bzr branch http://bzr.ed.am/android/export-contacts

« back to all changes in this revision

Viewing changes to src/am/ed/exportcontacts/ContactsContractBackend.java

  • Committer: edam
  • Date: 2013-01-06 18:11:57 UTC
  • Revision ID: tim@ed.am-20130106181157-ojglab4ju9je9ndr
stop using managedQuery(), which isn't cleaning up my queries

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
        public int getNumContacts()
49
49
        {
50
50
                // get number of aggregate contacts
51
 
                Cursor cursor = _activity.managedQuery(
 
51
                Cursor cur = _activity.getContentResolver().query(
52
52
                        ContactsContract.Contacts.CONTENT_URI,
53
53
                        new String[] {
54
54
                                ContactsContract.Contacts._ID,
55
55
                        }, null, null, null );
56
 
                return cursor.getCount();
 
56
                int ret = cur.getCount();
 
57
                cur.close();
 
58
                return ret;
57
59
        }
58
60
 
59
61
        private int convertBackendTypeToType( Class< ? > cls, int type )
107
109
                if( _cur == null )
108
110
                {
109
111
                        // get all aggregate contacts
110
 
                        _cur = _activity.managedQuery(
 
112
                        _cur = _activity.getContentResolver().query(
111
113
                                ContactsContract.Contacts.CONTENT_URI,
112
114
                                new String[] {
113
115
                                        ContactsContract.Contacts._ID,
116
118
                }
117
119
 
118
120
                // if there are no more aggregate contacts, abort
119
 
                if( _cur == null || !_cur.moveToNext() ) {
 
121
                if( _cur == null ) return false;
 
122
                if( !_cur.moveToNext() ) {
 
123
                        _cur.close();
120
124
                        _cur = null;
121
125
                        return false;
122
126
                }