Skip to content

Most visited

Recently visited

navigation

QuickContactBadge

public class QuickContactBadge
extends ImageView implements View.OnClickListener

java.lang.Object
   ↳ android.view.View
     ↳ android.widget.ImageView
       ↳ android.widget.QuickContactBadge


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

Summary

Inherited XML attributes

From class android.widget.ImageView
From class android.view.View

Inherited constants

From class android.view.View

Fields

protected String[] mExcludeMimes

Inherited fields

From class android.view.View

Public constructors

QuickContactBadge(Context context)
QuickContactBadge(Context context, AttributeSet attrs)
QuickContactBadge(Context context, AttributeSet attrs, int defStyleAttr)
QuickContactBadge(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)

Public methods

void assignContactFromEmail(String emailAddress, boolean lazyLookup, Bundle extras)

Assign a contact based on an email address.

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 assignContactFromPhone(String phoneNumber, boolean lazyLookup, Bundle extras)

Assign a contact based on a phone number.

void assignContactUri(Uri contactUri)

Assign the contact uri that this QuickContactBadge should be associated with.

void drawableHotspotChanged(float x, float y)

This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view.

CharSequence getAccessibilityClassName()

Return the class name of this object to be used for accessibility purposes.

void onClick(View v)

Called when a view has been clicked.

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

void setOverlay(Drawable overlay)

Assigns the drawable that is to be drawn on top of the assigned contact photo.

void setPrioritizedMimeType(String prioritizedMimeType)

Set which mimetype should be prioritized in the QuickContacts UI.

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 onAttachedToWindow()

This is called when the view is attached to a window.

void onDraw(Canvas canvas)

Implement this to do your drawing.

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.accessibility.AccessibilityEventSource
From interface android.view.View.OnClickListener

Fields

mExcludeMimes

Added in API level 5
String[] mExcludeMimes

Public constructors

QuickContactBadge

Added in API level 5
QuickContactBadge (Context context)

Parameters
context Context

QuickContactBadge

Added in API level 5
QuickContactBadge (Context context, 
                AttributeSet attrs)

Parameters
context Context
attrs AttributeSet

QuickContactBadge

Added in API level 5
QuickContactBadge (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context
attrs AttributeSet
defStyleAttr int

QuickContactBadge

Added in API level 21
QuickContactBadge (Context context, 
                AttributeSet attrs, 
                int defStyleAttr, 
                int defStyleRes)

Parameters
context Context
attrs AttributeSet
defStyleAttr int
defStyleRes int

Public methods

assignContactFromEmail

Added in API level 18
void assignContactFromEmail (String emailAddress, 
                boolean lazyLookup, 
                Bundle extras)

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 String: The email address of the contact.
lazyLookup boolean: If this is true, the lookup query will not be performed until this view is clicked.
extras Bundle: A bundle of extras to populate the contact edit page with if the contact is not found and the user chooses to add the email address to an existing contact or create a new contact. Uses the same string constants as those found in ContactsContract.Intents.Insert

assignContactFromEmail

Added in API level 5
void assignContactFromEmail (String emailAddress, 
                boolean lazyLookup)

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 String: The email address of the contact.
lazyLookup boolean: If this is true, the lookup query will not be performed until this view is clicked.

assignContactFromPhone

Added in API level 5
void assignContactFromPhone (String phoneNumber, 
                boolean lazyLookup)

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 String: The phone number of the contact.
lazyLookup boolean: If this is true, the lookup query will not be performed until this view is clicked.

assignContactFromPhone

Added in API level 18
void assignContactFromPhone (String phoneNumber, 
                boolean lazyLookup, 
                Bundle extras)

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 String: The phone number of the contact.
lazyLookup boolean: If this is true, the lookup query will not be performed until this view is clicked.
extras Bundle: A bundle of extras to populate the contact edit page with if the contact is not found and the user chooses to add the phone number to an existing contact or create a new contact. Uses the same string constants as those found in ContactsContract.Intents.Insert

assignContactUri

Added in API level 5
void assignContactUri (Uri contactUri)

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 Uri: Either a CONTENT_URI or CONTENT_LOOKUP_URI style URI.

drawableHotspotChanged

Added in API level 21
void drawableHotspotChanged (float x, 
                float y)

This function is called whenever the view hotspot changes and needs to be propagated to drawables or child views managed by the view.

Dispatching to child views is handled by dispatchDrawableHotspotChanged(float, float).

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

Parameters
x float: hotspot x coordinate
y float: hotspot y coordinate

getAccessibilityClassName

Added in API level 23
CharSequence getAccessibilityClassName ()

Return the class name of this object to be used for accessibility purposes. Subclasses should only override this if they are implementing something that should be seen as a completely new class of view when used by accessibility, unrelated to the class it is deriving from. This is used to fill in AccessibilityNodeInfo.setClassName.

Returns
CharSequence

onClick

Added in API level 5
void onClick (View v)

Called when a view has been clicked.

Parameters
v View: The view that was clicked.

setExcludeMimes

Added in API level 5
void setExcludeMimes (String[] excludeMimes)

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.

Parameters
excludeMimes String

setImageToDefault

Added in API level 11
void setImageToDefault ()

Resets the contact photo to the default state.

setMode

Added in API level 5
void setMode (int size)

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

Parameters
size int

setOverlay

Added in API level 21
void setOverlay (Drawable overlay)

Assigns the drawable that is to be drawn on top of the assigned contact photo.

Parameters
overlay Drawable: Drawable to be drawn over the assigned contact photo. Must have a non-zero instrinsic width and height.

setPrioritizedMimeType

Added in API level 23
void setPrioritizedMimeType (String prioritizedMimeType)

Set which mimetype should be prioritized in the QuickContacts UI. For example, passing the value CONTENT_ITEM_TYPE can cause emails to be displayed more prominently in QuickContacts.

Parameters
prioritizedMimeType String

Protected methods

drawableStateChanged

Added in API level 5
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.

If the View has a StateListAnimator, it will also be called to run necessary state change animations.

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

onAttachedToWindow

Added in API level 5
void onAttachedToWindow ()

This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it may be called any time before the first onDraw -- including before or after onMeasure(int, int).

onDraw

Added in API level 5
void onDraw (Canvas canvas)

Implement this to do your drawing.

Parameters
canvas Canvas: the canvas on which the background will be drawn
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.