Example usage for android.widget QuickContactBadge setImageBitmap

List of usage examples for android.widget QuickContactBadge setImageBitmap

Introduction

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

Prototype

@android.view.RemotableViewMethod
public void setImageBitmap(Bitmap bm) 

Source Link

Document

Sets a Bitmap as the content of this ImageView.

Usage

From source file:org.droid2droid.ui.contacts.AbstractSMSFragment.java

@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
    switch (scrollState) {
    case OnScrollListener.SCROLL_STATE_IDLE:
        int first = view.getFirstVisiblePosition();
        int count = view.getChildCount();

        for (int i = 0; i < count; i++) {
            long contactId = mAdapter.getItemId(first + i);
            if (contactId != 0) {
                QuickContactBadge icon = (QuickContactBadge) mList.getChildAt(i).findViewById(R.id.icon);
                if (sBitmapCache.containsKey(contactId)) {
                    icon.setImageBitmap(sBitmapCache.get(contactId).get());
                } else {
                    setDefaultImage(icon);
                    sImageFetchThreadPool.execute(new ImageDbFetcher(contactId, icon));
                }//from w w w. jav  a 2  s.  c o  m
            }
        }

        break;
    }
}

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  w  w. j av a 2s.  com*/

    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);
}