to top
Android APIs
public class

QuickContactBadge

extends ImageView
implements View.OnClickListener
java.lang.Object
   ↳ android.view.View
     ↳ android.widget.ImageView
       ↳ android.widget.QuickContactBadge

Class Overview

Widget used to show an image with the standard QuickContact badge and on-click behavior.

Summary

[Expand]
Inherited XML Attributes
From class android.widget.ImageView
From class android.view.View
[Expand]
Inherited Constants
From class android.view.View
Fields
protected String[] mExcludeMimes
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
QuickContactBadge(Context context)
QuickContactBadge(Context context, AttributeSet attrs)
QuickContactBadge(Context context, AttributeSet attrs, int defStyle)
Public Methods
void assignContactFromEmail(String emailAddress, boolean lazyLookup)
Assign a contact based on an email address.
void assignContactFromPhone(String phoneNumber, boolean lazyLookup)
Assign a contact based on a phone number.
void assignContactUri(Uri contactUri)
Assign the contact uri that this QuickContactBadge should be associated with.
void onClick(View v)
Called when a view has been clicked.
void onInitializeAccessibilityEvent(AccessibilityEvent event)
Initializes an AccessibilityEvent with information about this View which is the event source.
void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
Initializes an AccessibilityNodeInfo with information about this view.
void setExcludeMimes(String[] excludeMimes)
Set a list of specific MIME-types to exclude and not display.
void setImageToDefault()
Resets the contact photo to the default state.
void setMode(int size)
This call has no effect anymore, as there is only one QuickContact mode
Protected Methods
void drawableStateChanged()
This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.
void onDraw(Canvas canvas)
Implement this to do your drawing.
[Expand]
Inherited Methods
From class android.widget.ImageView
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.View.OnClickListener
From interface android.view.accessibility.AccessibilityEventSource

Fields

protected String[] mExcludeMimes

Since: API Level 5

Public Constructors

public QuickContactBadge (Context context)

Since: API Level 5

public QuickContactBadge (Context context, AttributeSet attrs)

Since: API Level 5

public QuickContactBadge (Context context, AttributeSet attrs, int defStyle)

Since: API Level 5

Public Methods

public void assignContactFromEmail (String emailAddress, boolean lazyLookup)

Since: API Level 5

Assign a contact based on an email address. This should only be used when the contact's URI is not available, as an extra query will have to be performed to lookup the URI based on the email.

Parameters
emailAddress The email address of the contact.
lazyLookup If this is true, the lookup query will not be performed until this view is clicked.

public void assignContactFromPhone (String phoneNumber, boolean lazyLookup)

Since: API Level 5

Assign a contact based on a phone number. This should only be used when the contact's URI is not available, as an extra query will have to be performed to lookup the URI based on the phone number.

Parameters
phoneNumber The phone number of the contact.
lazyLookup If this is true, the lookup query will not be performed until this view is clicked.

public void assignContactUri (Uri contactUri)

Since: API Level 5

Assign the contact uri that this QuickContactBadge should be associated with. Note that this is only used for displaying the QuickContact window and won't bind the contact's photo for you. Call setImageDrawable(Drawable) to set the photo.

Parameters
contactUri Either a CONTENT_URI or CONTENT_LOOKUP_URI style URI.

public void onClick (View v)

Since: API Level 5

Called when a view has been clicked.

Parameters
v The view that was clicked.

public void onInitializeAccessibilityEvent (AccessibilityEvent event)

Since: API Level 14

Initializes an AccessibilityEvent with information about this View which is the event source. In other words, the source of an accessibility event is the view whose state change triggered firing the event.

Example: Setting the password property of an event in addition to properties set by the super implementation:

 public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
     super.onInitializeAccessibilityEvent(event);
     event.setPassword(true);
 }

If an View.AccessibilityDelegate has been specified via calling setAccessibilityDelegate(AccessibilityDelegate) its onInitializeAccessibilityEvent(View, AccessibilityEvent) is responsible for handling this call.

Note: Always call the super implementation before adding information to the event, in case the default implementation has basic information to add.

Parameters
event The event to initialize.

public void onInitializeAccessibilityNodeInfo (AccessibilityNodeInfo info)

Since: API Level 14

Initializes an AccessibilityNodeInfo with information about this view. The base implementation sets:

Subclasses should override this method, call the super implementation, and set additional attributes.

If an View.AccessibilityDelegate has been specified via calling setAccessibilityDelegate(AccessibilityDelegate) its onInitializeAccessibilityNodeInfo(View, AccessibilityNodeInfo) is responsible for handling this call.

Parameters
info The instance to initialize.

public void setExcludeMimes (String[] excludeMimes)

Since: API Level 5

Set a list of specific MIME-types to exclude and not display. For example, this can be used to hide the CONTENT_ITEM_TYPE profile icon.

public void setImageToDefault ()

Since: API Level 11

Resets the contact photo to the default state.

public void setMode (int size)

Since: API Level 5

This call has no effect anymore, as there is only one QuickContact mode

Protected Methods

protected void drawableStateChanged ()

Since: API Level 5

This function is called whenever the state of the view changes in such a way that it impacts the state of drawables being shown.

Be sure to call through to the superclass when overriding this function.

protected void onDraw (Canvas canvas)

Since: API Level 5

Implement this to do your drawing.

Parameters
canvas the canvas on which the background will be drawn