/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/org/waxworlds/edam/exportcontacts/ContactsContactReader.java

  • Committer: edam
  • Date: 2011-06-11 08:22:04 UTC
  • Revision ID: edam@waxworlds.org-20110611082204-u2v1ri3a8iayq9b4
- added ContactReader interface
- added ContactsContactReader class to read old-style android.Contacts data
- updated FileChooser from import contacts app
- updated TODO
- added Doit activity
- added Exporter
- added VcardExporter that writes vCards

Show diffs side-by-side

added added

removed removed

1
1
/*
2
 
 * ContactsContactAccessor.java
 
2
 * ContactsContactReader.java
3
3
 *
4
 
 * Copyright (C) 2011 Tim Marston <edam@waxworlds.org>
 
4
 * Copyright (C) 2010 Tim Marston <edam@waxworlds.org>
5
5
 *
6
6
 * This file is part of the Export Contacts program (hereafter referred
7
7
 * to as "this program"). For more information, see
27
27
import android.database.Cursor;
28
28
import android.provider.Contacts;
29
29
 
30
 
public class ContactsContactAccessor implements ContactAccessor
 
30
public class ContactsContactReader implements ContactReader
31
31
{
32
32
        Activity _activity = null;
33
33
        Exporter _exporter = null;
34
34
        Cursor _cur = null;
35
35
 
36
 
        public ContactsContactAccessor( Activity activity, Exporter exporter )
 
36
        public ContactsContactReader( Activity activity, Exporter exporter )
37
37
        {
38
38
                _activity = activity;
39
39
                _exporter = exporter;
92
92
                                        Contacts.Organizations.COMPANY ) ),
93
93
                                cur.getString( cur.getColumnIndex(
94
94
                                        Contacts.Organizations.TITLE ) ) ) );
95
 
                cur.close();
96
95
 
97
96
                // get the phone numbers
98
97
                cur = _activity.managedQuery( Contacts.Phones.CONTENT_URI,
109
108
                                        Contacts.Phones.TYPE ) ),
110
109
                                cur.getString( cur.getColumnIndex(
111
110
                                        Contacts.Phones.NUMBER ) ) ) );
112
 
                cur.close();
113
111
 
114
112
                // get the email and postal addresses
115
113
                cur = _activity.managedQuery( Contacts.ContactMethods.CONTENT_URI,
143
141
                                        cur.getString( cur.getColumnIndex(
144
142
                                                Contacts.ContactMethods.DATA ) ) ) );
145
143
                }
146
 
                cur.close();
147
144
 
148
145
                return true;
149
146
        }