Example usage for android.widget QuickContactBadge assignContactFromEmail

List of usage examples for android.widget QuickContactBadge assignContactFromEmail

Introduction

In this page you can find the example usage for android.widget QuickContactBadge assignContactFromEmail.

Prototype

public void assignContactFromEmail(String emailAddress, boolean lazyLookup) 

Source Link

Document

Assign a contact based on an email address.

Usage

From source file:net.vivekiyer.GAL.CorporateContactRecordFragment.java

private void setContact() {
    final View view = getView();

    m_adapter = new ContactDetailsAdapter(this.getActivity(), R.layout.detail_row, mContact.getDetails());
    setListAdapter(m_adapter);/*from w  ww .  jav  a2  s  .  c  o m*/

    final TextView tv1 = (TextView) view.findViewById(R.id.toptext);
    tv1.setText(mContact.getDisplayName());

    final TextView tv2 = (TextView) view.findViewById(R.id.bottomtext);
    // Set the bottom text
    if (tv2 != null) {
        String s;
        if ((s = mContact.getTitle()).length() != 0)
            s = s + ", "; //$NON-NLS-1$
        {
            tv2.setText(s + mContact.getCompany());
        }
    }

    QuickContactBadge qcb = (QuickContactBadge) view.findViewById(R.id.contactPicture);
    qcb.assignContactFromEmail(mContact.getEmail(), true);
    qcb.setMode(ContactsContract.QuickContact.MODE_LARGE);
    byte[] pic;
    if ((pic = mContact.getPicture()) != null) {
        Bitmap bm = BitmapFactory.decodeByteArray(pic, 0, pic.length);
        qcb.setImageBitmap(bm);
    }

    // getListView().setOnItemLongClickListener(mListViewLongClickListener);
    contactWriter = new ContactWriterSdk5(App.getInstance(), mContact);

    view.findViewById(R.id.contactHeader).setVisibility(View.VISIBLE);
    setSaveMenuEnabled(true);
}