ContactPicker

Last Updated On 2021-07-16

Version 6MinSDK 7Tutorial Video

A button that, when clicked on, displays a list of the contacts to choose among. After the user has made a selection, the following properties will be set to information about the chosen contact:

  • ContactName: the contact's name
  • EmailAddress: the contact's primary email address
  • ContactUri: the contact's URI on the device
  • EmailAddressList: a list of the contact's email addresses
  • PhoneNumber: the contact's primary phone number (on Later Android Verisons)
  • PhoneNumberList: a list of the contact's phone numbers (on Later Android Versions)
  • Picture: the name of the file containing the contact's image, which can be used as a Picture property value for the Image or ImageSprite component.

Other properties affect the appearance of the button (TextAlignment, BackgroundColor, etc.) and whether it can be clicked on (Enabled).

The ContactPicker component might not work on all phones. For example, on Android systems before system 3.0, it cannot pick phone numbers, and the list of email addresses will contain only one email.


Properties

You can set the below properties in the UI part of the builder.

  • BackgroundColor - it's a color value which is set to &h00000000 by default.
  • CustomFontTypeFace - it's a asset value which is set to blank by default.
  • Enabled - it's a boolean value which is set to true by default.
  • FontBold - it's a boolean value which is set to false by default.
  • FontItalic - it's a boolean value which is set to false by default.
  • FontSize - it's a non negative float value which is set to 14.0 by default.
  • FontTypeface - it's a typeface value which is set to 0 by default.
  • HeihMargin - it's a four value which is set to 0,0,0,0 by default.
  • HeihPadding - it's a four value which is set to 0,0,0,0 by default.
  • Image - it's a asset value which is set to blank by default.
  • MarginBottom - it's a non negative float value which is set to 0 by default.
  • MarginLeft - it's a non negative float value which is set to 0 by default.
  • MarginRight - it's a non negative float value which is set to 0 by default.
  • MarginTop - it's a non negative float value which is set to 0 by default.
  • Opacity - it's a integer value which is set to 0 by default.
  • PaddingBottom - it's a non negative float value which is set to 0 by default.
  • PaddingLeft - it's a non negative float value which is set to 0 by default.
  • PaddingRight - it's a non negative float value which is set to 0 by default.
  • PaddingTop - it's a non negative float value which is set to 0 by default.
  • Shape - it's a button shape value which is set to 0 by default.
  • ShowFeedback - it's a boolean value which is set to true by default.
  • Text - it's a string value which is set to blank by default.
  • TextAlignment - it's a textalignment value which is set to 1 by default.
  • TextColor - it's a color value which is set to &h00000000 by default.
  • Visible - it's a visibility value which is set to true by default.

Block Properties

You can set the below blocks properties in the blocks section of the builder.

BackgroundColor

Returns the button's background color


ContactName

Returns the full name of the selected contact, or the empty string if a name is unavailable.


ContactUri

URI that specifies the location of the contact on the device.


CustomFontTypeFace

Sets the custom font


EmailAddress

Returns the primary email address of the selected contact, or the empty string if an email address is unavailable.


EmailAddressList

Returns a list of email addresses associated with the selected contact.


Enabled

If set, user can tap ContactPicker to cause action.


FontBold

If set, ContactPicker text is displayed in bold.


FontItalic

If set, ContactPicker text is displayed in italics.


FontSize

Point size for ContactPicker text.


Height

Specifies the vertical height of the ContactPicker, measured in pixels.


HeightPercent

Specifies the vertical height of the ContactPicker as a percentage of the height of the Screen.


Image

Image to display on button.


MarginBottom

Property for MarginBottom


MarginLeft

Property for MarginLeft


MarginRight

Property for MarginRight


MarginTop

Property for MarginTop


Opacity

Set opacity value between 1 to 10


PaddingBottom

Property for PaddingBottom


PaddingLeft

Property for PaddingLeft


PaddingRight

Property for PaddingRight


PaddingTop

Property for PaddingTop


PhoneNumber

Returns the primary phone number associated with the selected contact, or the empty string if no phone number is associated with the contact.


PhoneNumberList

Returns a list of phone numbers associated with the selected contact.


Picture

Returns a picture URI for the selected contact, which can be used to retrieve the contact's photo and other fields.


ShowFeedback

Specifies if a visual feedback should be shown for a ContactPicker that has an image as background.


Text

Text to display on ContactPicker.


TextColor

Color for button text.


Visible

Specifies whether the ContactPicker should be visible on the screen. Value is true if the ContactPicker is showing and false if hidden.


Width

Specifies the horizontal width of the ContactPicker, measured in pixels.


WidthPercent

Specifies the horizontal width of the ContactPicker as a percentage of the width of the Screen.



Methods

You can set the below method blocks in the blocks section of the builder.

Open

Opens the ContactPicker, as though the user clicked on it.

PerformClick

Method for PerformClick

ViewContact

view a contact via its URI


Events

You can set the below event blocks in the blocks section of the builder.

AfterPicking

Event to be raised after the `ContactPicker` activity returns its result and the properties have been filled in.

BeforePicking

Event to raise when the `ContactPicker` is clicked or the picker is shown using the

GotFocus

Indicates the cursor moved over the ContactPicker so it is now possible to click it.

LostFocus

Indicates the cursor moved away from the ContactPicker so it is now no longer possible to click it.

TouchDown

Indicates that the ContactPicker was pressed down.

TouchUp

Indicates that the ContactPicker has been released.