dineth
dineth

Reputation: 9942

Where to find the Contact View in Android?

I notice that some of the base applications in Android are using this little control (View in Android terms I guess) that shows the contact picture. When you click on the picture it shows all the ways of contacting the person (phone, sms, talk, facebook). I see this little View used in the contact app, sms app, twitter for android, facebook for android etc.

Is there a library or a way of getting this working on my own application or do I need to write this from scratch?

Upvotes: 2

Views: 1083

Answers (1)

Pentium10
Pentium10

Reputation: 207912

You can reference the QuickContactBadge in the XML

I have this in the XML file:

     <QuickContactBadge
     android:id="@+id/photo"
    android:layout_width="54dip"
    android:layout_height="57dip"
    android:layout_marginLeft="5dip"
    android:background="@drawable/quickcontact_photo_frame"
    style="?android:attr/quickContactBadgeStyleWindowSmall"
     />

and this code:

private QuickContactBadge mPhotoView;
mPhotoView = (QuickContactBadge) findViewById(R.id.photo);
mPhotoView.assignContactUri(objItem.getUri());
mPhotoView.setMode(QuickContact.MODE_MEDIUM);

and this is the calling mode (but the click on the badge is handling this popup, this call to popup the chooser is made by clicking on something else, you don't need if you just want the quick contact to show when clicking on the badge, that's already built in)

QuickContact.showQuickContact(viewContactQuick.this, mPhotoView,objItem.getLookupUri() , QuickContact.MODE_MEDIUM, null);

Upvotes: 2

Related Questions