/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/Exporter.java

  • Committer: edam
  • Date: 2012-12-21 15:53:59 UTC
  • Revision ID: tim@ed.am-20121221155359-p8h3n0xhtulmwva0
fixed column values in Contacts backend; don't write-out empty notes; remember to close my queries; switched from wrappers to static valueOf() functions; fix line-endings (should be \r\n)

Show diffs side-by-side

added added

removed removed

Lines of Context:
285
285
        protected void exportContacts() throws AbortExportException
286
286
        {
287
287
                // set up a contact reader
288
 
                Backend contact_reader = null;
 
288
                Backend backend = null;
289
289
                if( Integer.parseInt( android.os.Build.VERSION.SDK ) >= 5 )
290
 
                        contact_reader = new ContactsContractBackend( _doit, this );
 
290
                        backend = new ContactsContractBackend( _doit, this );
291
291
                else
292
 
                        contact_reader = new ContactsBackend( _doit, this );
 
292
                        backend = new ContactsBackend( _doit, this );
293
293
 
294
294
                // check we have contacts
295
 
                int num_contacts = contact_reader.getNumContacts();
 
295
                int num_contacts = backend.getNumContacts();
296
296
                if( num_contacts == 0 )
297
297
                        showError( R.string.error_nothingtodo );
298
298
 
308
308
                while( true ) {
309
309
                        checkAbort();
310
310
                        ContactData contact = new ContactData();
311
 
                        if( !contact_reader.getNextContact( contact ) )
 
311
                        if( !backend.getNextContact( contact ) )
312
312
                                break;
313
313
 
314
314
                        // export this one
427
427
                checkAbort();
428
428
                _doit._handler.sendMessage( Message.obtain(
429
429
                        _doit._handler, Doit.MESSAGE_SETMAXPROGRESS,
430
 
                        new Integer( max_progress ) ) );
 
430
                        Integer.valueOf( max_progress ) ) );
431
431
        }
432
432
 
433
433
        protected void setTmpProgress( int tmp_progress )
436
436
                checkAbort();
437
437
                _doit._handler.sendMessage( Message.obtain(
438
438
                        _doit._handler, Doit.MESSAGE_SETTMPPROGRESS,
439
 
                        new Integer( tmp_progress ) ) );
 
439
                        Integer.valueOf( tmp_progress ) ) );
440
440
        }
441
441
 
442
442
        protected void setProgress( int progress ) throws AbortExportException
444
444
                checkAbort();
445
445
                _doit._handler.sendMessage( Message.obtain(
446
446
                        _doit._handler, Doit.MESSAGE_SETPROGRESS,
447
 
                        new Integer( progress ) ) );
 
447
                        Integer.valueOf( progress ) ) );
448
448
        }
449
449
 
450
450
        protected void finish( int action ) throws AbortExportException