Hi All:

        I am reading and debuging Contacts source code now. But I am
very confusing about ExportVCardActivity.java,
In ActualExportThread class, I can't see anything about the contacts'
data related to the VCardComoser object,
how do they combined the contacts' data and VCardComoser object? I
want to implement a filter that can filter
the contacts' data depend on some conditions, what should I do? Thanks
very much if someone could help me!


source code:
              VCardComposer composer = null;
            try {
                OutputStream outputStream = null;
                try {
                    outputStream = new
FileOutputStream(mExportingFileName);
                } catch (FileNotFoundException e) {
                    final String errorReason =
 
getString(R.string.fail_reason_could_not_open_file,
                                mExportingFileName, e.getMessage());
                    shouldCallFinish = false;
                    mHandler.post(new
ErrorReasonDisplayer(errorReason));
                    return;
                }

                // composer = new
VCardComposer(ExportVCardActivity.this, mVCardTypeStr, true);
                int vcardType = VCardConfig.VCARD_TYPE_V30_GENERIC;
                composer = new VCardComposer(ExportVCardActivity.this,
vcardType, true);

                composer.addHandler(composer.new
HandlerForOutputStream(outputStream));

                if (!composer.init()) {
                    final String errorReason =
composer.getErrorReason();
                    Log.e(LOG_TAG, "initialization of vCard composer
failed: " + errorReason);
                    final String translatedErrorReason =
                            translateComposerError(errorReason);
                    mHandler.post(new ErrorReasonDisplayer(
 
getString(R.string.fail_reason_could_not_initialize_exporter,
                                    translatedErrorReason)));
                    shouldCallFinish = false;
                    return;
                }

                int size = composer.getCount();

                if (size == 0) {
                    mHandler.post(new ErrorReasonDisplayer(
 
getString(R.string.fail_reason_no_exportable_contact)));
                    shouldCallFinish = false;
                    return;
                }

                mProgressDialog.setProgressNumberFormat(
 
getString(R.string.exporting_contact_list_progress));
                mProgressDialog.setMax(size);
                mProgressDialog.setProgress(0);

                while (!composer.isAfterLast()) {

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to