Hi All

I am fetching address(city, country, street, phone, email,website,
organization, etc). When I fetch all these values it takes long lime to be
fetched.I need to make it fast. Here is my one fething below.Please
help to make the query fast.

Here "id" is the contact id.


    public void Get_Contact_Address(String id) {
        String[] pro = new String[] {
                ContactsContract.CommonDataKinds.StructuredPostal.CITY,
                ContactsContract.CommonDataKinds.StructuredPostal.TYPE,
                ContactsContract.CommonDataKinds.StructuredPostal.STREET,
                ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE
};

        String where = ContactsContract.Data.CONTACT_ID + " = ? AND "
                + ContactsContract.Data.MIMETYPE + " = ?";
        String[] whereParams = new String[] {
                id,

ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_ITEM_TYPE };
        Cursor addrCur = contentresolver.query(
                ContactsContract.Data.CONTENT_URI, pro, where, whereParams,
                null);

        while (addrCur.moveToNext()) {
            String type = Null_check(addrCur
                    .getString(addrCur

.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.TYPE)));
            if (type.equals("2")) {
                contactcontent.contact_work_address_city =
Null_check(addrCur
                        .getString(addrCur

.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.CITY)));
                contactcontent.contact_work_address_postcode =
Null_check(addrCur
                        .getString(addrCur

.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.POSTCODE)));
                contactcontent.contact_work_address_street =
Null_check(addrCur
                        .getString(addrCur

.getColumnIndex(ContactsContract.CommonDataKinds.StructuredPostal.STREET)));
                break;
            }
        }
        addrCur.close();

    }


this is working fine.but takes long time to be fetched.
Any suggestions will be fine for me.

Regards
RiskyCoder

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

Reply via email to