/android/import-contacts

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

« back to all changes in this revision

Viewing changes to src/am/ed/importcontacts/ContactsBackend.java

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

Show diffs side-by-side

added added

removed removed

58
58
                HashMap< Long, String > notes = new HashMap< Long, String >();
59
59
 
60
60
                // get all contacts
61
 
                cur = _activity.managedQuery( Contacts.People.CONTENT_URI,
 
61
                cur = _activity.getContentResolver().query(
 
62
                        Contacts.People.CONTENT_URI,
62
63
                        new String[] {
63
64
                                Contacts.People._ID,
64
65
                                Contacts.People.NAME,
96
97
                                        notes.put( id, note );
97
98
                        }
98
99
                }
 
100
                cur.close();
99
101
 
100
102
                // get contact organisations, primary ones first
101
 
                cur = _activity.managedQuery( Contacts.Organizations.CONTENT_URI,
 
103
                cur = _activity.getContentResolver().query(
 
104
                        Contacts.Organizations.CONTENT_URI,
102
105
                        new String[] {
103
106
                                Contacts.Phones.PERSON_ID,
104
107
                                Contacts.Organizations.COMPANY,
124
127
                        // add associated data
125
128
                        cache.addAssociatedOrganisation( id, organisation );
126
129
                }
 
130
                cur.close();
127
131
 
128
132
                // get all phone numbers, primary ones first
129
 
                cur = _activity.managedQuery( Contacts.Phones.CONTENT_URI,
 
133
                cur = _activity.getContentResolver().query(
 
134
                        Contacts.Phones.CONTENT_URI,
130
135
                        new String[] {
131
136
                                Contacts.Phones.PERSON_ID,
132
137
                                Contacts.Phones.NUMBER,
152
157
                        // add associated data
153
158
                        cache.addAssociatedNumber( id, number );
154
159
                }
 
160
                cur.close();
155
161
 
156
162
                // now get all email addresses, primary ones first, and postal addresses
157
 
                cur = _activity.managedQuery( Contacts.ContactMethods.CONTENT_URI,
 
163
                cur = _activity.getContentResolver().query(
 
164
                        Contacts.ContactMethods.CONTENT_URI,
158
165
                        new String[] {
159
166
                                Contacts.ContactMethods.PERSON_ID,
160
167
                                Contacts.ContactMethods.DATA,
198
205
                                cache.addAssociatedAddress( id, address );
199
206
                        }
200
207
                }
 
208
                cur.close();
201
209
 
202
210
                // finally, add the notes that we stored earlier (we have to add these
203
211
                // at the end because we can't be sure which piece of contact data will