public static class

HtcAlertDialog.Builder

extends Object
java.lang.Object
   ↳ com.htc.widget.HtcAlertDialog.Builder

Summary

Fields
protected final HtcAlertController.AlertParams P
Public Constructors
HtcAlertDialog.Builder(Context context)
Constructor using a context for this builder and the HtcAlertDialog it creates.
Public Methods
HtcAlertDialog create()
Creates a HtcAlertDialog with the arguments supplied to this builder.
HtcAlertDialog.Builder setAdapter(ListAdapter adapter, DialogInterface.OnClickListener listener)
Sets a list of items, which are supplied by the given ListAdapter, to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setCancelable(boolean cancelable)
Sets whether the dialog is cancelable or not default is true.
HtcAlertDialog.Builder setCursor(Cursor cursor, DialogInterface.OnClickListener listener, String labelColumn)
Sets a list of items, which are supplied by the given Cursor, to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setCustomTitle(View customTitleView)
Sets the title using the custom view customTitleView.
HtcAlertDialog.Builder setIcon(Drawable icon)
Sets the Drawable to be used in the title.
HtcAlertDialog.Builder setIcon(int iconId)
Sets the resource id of the Drawable to be used in the title.
HtcAlertDialog.Builder setInverseBackgroundForced(boolean useInverseBackground)
Sets the Dialog to use the inverse background, regardless of what the contents is.
HtcAlertDialog.Builder setIsAutoMotive(boolean b)
This api is for enable AutoMotive mode When you call this api, your activity must lock at landscape mode always.
HtcAlertDialog.Builder setItems(int itemsId, DialogInterface.OnClickListener listener)
Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setItems(CharSequence[] items, DialogInterface.OnClickListener listener)
Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setMessage(CharSequence message, int nAutoLinkMask)
HtcAlertDialog.Builder setMessage(CharSequence message)
Sets the message to display.
HtcAlertDialog.Builder setMessage(int messageId)
Sets the message to display using the given resource id.
HtcAlertDialog.Builder setMultiChoiceItems(CharSequence[] items, boolean[] checkedItems, DialogInterface.OnMultiChoiceClickListener listener)
Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setMultiChoiceItems(Cursor cursor, String isCheckedColumn, String labelColumn, DialogInterface.OnMultiChoiceClickListener listener)
Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setMultiChoiceItems(int itemsId, boolean[] checkedItems, DialogInterface.OnMultiChoiceClickListener listener)
Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setNegativeButton(CharSequence text, DialogInterface.OnClickListener listener)
Sets a listener to be invoked when the negative button of the dialog is pressed.
HtcAlertDialog.Builder setNegativeButton(int textId, DialogInterface.OnClickListener listener)
Sets a listener to be invoked when the negative button of the dialog is pressed.
HtcAlertDialog.Builder setNegativeButtonDisabled(boolean disabled)
Disables the Dialog negative button
HtcAlertDialog.Builder setNeutralButton(int textId, DialogInterface.OnClickListener listener)
Sets a listener to be invoked when the neutral button of the dialog is pressed.
HtcAlertDialog.Builder setNeutralButton(CharSequence text, DialogInterface.OnClickListener listener)
Sets a listener to be invoked when the neutral button of the dialog is pressed.
HtcAlertDialog.Builder setNeutralButtonDisabled(boolean disabled)
Disables the Dialog neutral button
HtcAlertDialog.Builder setOnCancelListener(DialogInterface.OnCancelListener onCancelListener)
Sets the callback that will be called if the dialog is canceled.
HtcAlertDialog.Builder setOnItemSelectedListener(AdapterView.OnItemSelectedListener listener)
Sets a listener to be invoked when an item in the list is selected.
HtcAlertDialog.Builder setOnKeyListener(DialogInterface.OnKeyListener onKeyListener)
Sets the callback that will be called if a key is dispatched to the dialog.
HtcAlertDialog.Builder setPositiveButton(int textId, DialogInterface.OnClickListener listener)
Sets a listener to be invoked when the positive button of the dialog is pressed.
HtcAlertDialog.Builder setPositiveButton(CharSequence text, DialogInterface.OnClickListener listener)
Sets a listener to be invoked when the positive button of the dialog is pressed.
HtcAlertDialog.Builder setPositiveButtonDisabled(boolean disabled)
Disables the Dialog positive button
HtcAlertDialog.Builder setSingleChoiceItems(CharSequence[] items, int checkedItem, DialogInterface.OnClickListener listener)
Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setSingleChoiceItems(ListAdapter adapter, int checkedItem, DialogInterface.OnClickListener listener)
Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setSingleChoiceItems(int itemsId, int checkedItem, DialogInterface.OnClickListener listener)
Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setSingleChoiceItems(Cursor cursor, int checkedItem, String labelColumn, DialogInterface.OnClickListener listener)
Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.
HtcAlertDialog.Builder setTitle(CharSequence title)
Sets the title displayed in the Dialog.
HtcAlertDialog.Builder setTitle(int titleId)
Sets the title using the given resource id.
HtcAlertDialog.Builder setTitleCenterEnabled(boolean enable)
Sets the Dialog to enable title center
HtcAlertDialog.Builder setTitleDividerVisible(boolean visible)
Sets the Dialog title divider visibility
HtcAlertDialog.Builder setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom)
Sets a custom view to be the contents of the Dialog, specifying the spacing to appear around that view.
HtcAlertDialog.Builder setView(View view)
Sets a custom view to be the contents of the Dialog.
HtcAlertDialog show()
Creates a HtcAlertDialog with the arguments supplied to this builder and show()'s the dialog.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

Public Constructors

public HtcAlertDialog.Builder (Context context)

Since: API Level 2.0

Constructor using a context for this builder and the HtcAlertDialog it creates.

Public Methods

public HtcAlertDialog create ()

Since: API Level 2.0

Creates a HtcAlertDialog with the arguments supplied to this builder. It does not show() the dialog. This allows the user to do any extra processing before displaying the dialog. Use show() if you don't have any other processing to do and want this to be created and displayed.

public HtcAlertDialog.Builder setAdapter (ListAdapter adapter, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a list of items, which are supplied by the given ListAdapter, to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.

Parameters
adapter The ListAdapter to supply the list of items
listener The listener that will be called when an item is clicked.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setCancelable (boolean cancelable)

Since: API Level 2.0

Sets whether the dialog is cancelable or not default is true.

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setCursor (Cursor cursor, DialogInterface.OnClickListener listener, String labelColumn)

Since: API Level 2.0

Sets a list of items, which are supplied by the given Cursor, to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.

Parameters
cursor The Cursor to supply the list of items
listener The listener that will be called when an item is clicked.
labelColumn The column name on the cursor containing the string to display in the label.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setCustomTitle (View customTitleView)

Since: API Level 2.0

Sets the title using the custom view customTitleView. The methods setTitle(int) and setIcon(int) should be sufficient for most titles, but this is provided if the title needs more customization. Using this will replace the title and icon set via the other methods.

Parameters
customTitleView The custom view to use as the title.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setIcon (Drawable icon)

Since: API Level 2.0

Sets the Drawable to be used in the title.

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setIcon (int iconId)

Since: API Level 2.0

Sets the resource id of the Drawable to be used in the title.

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setInverseBackgroundForced (boolean useInverseBackground)

Since: API Level 2.0

Sets the Dialog to use the inverse background, regardless of what the contents is.

Parameters
useInverseBackground Whether to use the inverse background
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setIsAutoMotive (boolean b)

Since: API Level 4.8

This api is for enable AutoMotive mode When you call this api, your activity must lock at landscape mode always. otherwise will have exception. And you also can not call this at landscape and rotate your activity to portrait mode. This will cause HtcAlertDialog truncate.

public HtcAlertDialog.Builder setItems (int itemsId, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener. This should be an array type i.e. R.array.foo

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setItems (CharSequence[] items, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener.

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setMessage (CharSequence message, int nAutoLinkMask)

Since: API Level 2.0

public HtcAlertDialog.Builder setMessage (CharSequence message)

Since: API Level 2.0

Sets the message to display.

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setMessage (int messageId)

Since: API Level 2.0

Sets the message to display using the given resource id.

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setMultiChoiceItems (CharSequence[] items, boolean[] checkedItems, DialogInterface.OnMultiChoiceClickListener listener)

Since: API Level 2.0

Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener. The list will have a check mark displayed to the right of the text for each checked item. Clicking on an item in the list will not dismiss the dialog. Clicking on a button will dismiss the dialog.

Parameters
items The text of the items to be displayed in the list.
checkedItems Specifies which items are checked. It should be null in which case no items are checked. If non null it must be exactly the same length as the array of items.
listener Listener notified when an item on the list is clicked. The dialog will not be dismissed when an item is clicked. It will only be dismissed if clicked on a button, if no buttons are supplied it's up to the user to dismiss the dialog.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setMultiChoiceItems (Cursor cursor, String isCheckedColumn, String labelColumn, DialogInterface.OnMultiChoiceClickListener listener)

Since: API Level 2.0

Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener. The list will have a check mark displayed to the right of the text for each checked item. Clicking on an item in the list will not dismiss the dialog. Clicking on a button will dismiss the dialog.

Parameters
cursor The cursor used to provide the items.
isCheckedColumn Specifies the column name on the cursor to use to determine whether a checkbox is checked or not. It must return an integer value where 1 means checked and 0 means unchecked.
labelColumn The column name on the cursor containing the string to display in the label.
listener Listener notified when an item on the list is clicked. The dialog will not be dismissed when an item is clicked. It will only be dismissed if clicked on a button, if no buttons are supplied it's up to the user to dismiss the dialog.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setMultiChoiceItems (int itemsId, boolean[] checkedItems, DialogInterface.OnMultiChoiceClickListener listener)

Since: API Level 2.0

Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener. This should be an array type, e.g. R.array.foo. The list will have a check mark displayed to the right of the text for each checked item. Clicking on an item in the list will not dismiss the dialog. Clicking on a button will dismiss the dialog.

Parameters
itemsId The resource id of an array i.e. R.array.foo
checkedItems Specifies which items are checked. It should be null in which case no items are checked. If non null it must be exactly the same length as the array of items.
listener Listener notified when an item on the list is clicked. The dialog will not be dismissed when an item is clicked. It will only be dismissed if clicked on a button, if no buttons are supplied it's up to the user to dismiss the dialog.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setNegativeButton (CharSequence text, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a listener to be invoked when the negative button of the dialog is pressed.

Parameters
text The text to display in the negative button
listener The DialogInterface.OnClickListener to use.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setNegativeButton (int textId, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a listener to be invoked when the negative button of the dialog is pressed.

Parameters
textId The resource id of the text to display in the negative button
listener The DialogInterface.OnClickListener to use.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setNegativeButtonDisabled (boolean disabled)

Since: API Level 2.0

Disables the Dialog negative button

Parameters
disabled Whether to disabled negative button
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setNeutralButton (int textId, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a listener to be invoked when the neutral button of the dialog is pressed.

Parameters
textId The resource id of the text to display in the neutral button
listener The DialogInterface.OnClickListener to use.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setNeutralButton (CharSequence text, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a listener to be invoked when the neutral button of the dialog is pressed.

Parameters
text The text to display in the neutral button
listener The DialogInterface.OnClickListener to use.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setNeutralButtonDisabled (boolean disabled)

Since: API Level 2.0

Disables the Dialog neutral button

Parameters
disabled Whether to disabled neutral button
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setOnCancelListener (DialogInterface.OnCancelListener onCancelListener)

Since: API Level 2.0

Sets the callback that will be called if the dialog is canceled.

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setOnItemSelectedListener (AdapterView.OnItemSelectedListener listener)

Since: API Level 2.0

Sets a listener to be invoked when an item in the list is selected.

Parameters
listener The listener to be invoked.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setOnKeyListener (DialogInterface.OnKeyListener onKeyListener)

Since: API Level 2.0

Sets the callback that will be called if a key is dispatched to the dialog.

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setPositiveButton (int textId, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a listener to be invoked when the positive button of the dialog is pressed.

Parameters
textId The resource id of the text to display in the positive button
listener The DialogInterface.OnClickListener to use.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setPositiveButton (CharSequence text, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a listener to be invoked when the positive button of the dialog is pressed.

Parameters
text The text to display in the positive button
listener The DialogInterface.OnClickListener to use.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setPositiveButtonDisabled (boolean disabled)

Since: API Level 2.0

Disables the Dialog positive button

Parameters
disabled Whether to disabled positive button
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setSingleChoiceItems (CharSequence[] items, int checkedItem, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener. The list will have a check mark displayed to the right of the text for the checked item. Clicking on an item in the list will not dismiss the dialog. Clicking on a button will dismiss the dialog.

Parameters
items The items to be displayed.
checkedItem Specifies which item is checked. If -1 no items are checked.
listener Listener notified when an item on the list is clicked. The dialog will not be dismissed when an item is clicked. It will only be dismissed if clicked on a button, if no buttons are supplied it's up to the user to dismiss the dialog.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setSingleChoiceItems (ListAdapter adapter, int checkedItem, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener. The list will have a check mark displayed to the right of the text for the checked item. Clicking on an item in the list will not dismiss the dialog. Clicking on a button will dismiss the dialog.

Parameters
adapter The ListAdapter to supply the list of items
checkedItem Specifies which item is checked. If -1 no items are checked.
listener Listener notified when an item on the list is clicked. The dialog will not be dismissed when an item is clicked. It will only be dismissed if clicked on a button, if no buttons are supplied it's up to the user to dismiss the dialog.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setSingleChoiceItems (int itemsId, int checkedItem, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener. This should be an array type i.e. R.array.foo The list will have a check mark displayed to the right of the text for the checked item. Clicking on an item in the list will not dismiss the dialog. Clicking on a button will dismiss the dialog.

Parameters
itemsId The resource id of an array i.e. R.array.foo
checkedItem Specifies which item is checked. If -1 no items are checked.
listener Listener notified when an item on the list is clicked. The dialog will not be dismissed when an item is clicked. It will only be dismissed if clicked on a button, if no buttons are supplied it's up to the user to dismiss the dialog.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setSingleChoiceItems (Cursor cursor, int checkedItem, String labelColumn, DialogInterface.OnClickListener listener)

Since: API Level 2.0

Sets a list of items to be displayed in the dialog as the content, you will be notified of the selected item via the supplied listener. The list will have a check mark displayed to the right of the text for the checked item. Clicking on an item in the list will not dismiss the dialog. Clicking on a button will dismiss the dialog.

Parameters
cursor The cursor to retrieve the items from.
checkedItem Specifies which item is checked. If -1 no items are checked.
labelColumn The column name on the cursor containing the string to display in the label.
listener Listener notified when an item on the list is clicked. The dialog will not be dismissed when an item is clicked. It will only be dismissed if clicked on a button, if no buttons are supplied it's up to the user to dismiss the dialog.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setTitle (CharSequence title)

Since: API Level 2.0

Sets the title displayed in the Dialog.

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setTitle (int titleId)

Since: API Level 2.0

Sets the title using the given resource id.

Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setTitleCenterEnabled (boolean enable)

Since: API Level 2.0

Sets the Dialog to enable title center

Parameters
enable Whether to enable title center
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setTitleDividerVisible (boolean visible)

Since: API Level 2.0

Sets the Dialog title divider visibility

Parameters
visible The visiblity of title divider
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setView (View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom)

Since: API Level 4.0

Sets a custom view to be the contents of the Dialog, specifying the spacing to appear around that view. If the supplied view is an instance of a ListView the light background will be used.

Parameters
view The view to use as the contents of the Dialog.
viewSpacingLeft Spacing between the left edge of the view and the dialog frame
viewSpacingTop Spacing between the top edge of the view and the dialog frame
viewSpacingRight Spacing between the right edge of the view and the dialog frame
viewSpacingBottom Spacing between the bottom edge of the view and the dialog frame
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog.Builder setView (View view)

Since: API Level 2.0

Sets a custom view to be the contents of the Dialog. If the supplied view is an instance of a ListView the light background will be used.

Parameters
view The view to use as the contents of the Dialog.
Returns
  • This Builder object to allow for chaining of calls to set methods

public HtcAlertDialog show ()

Since: API Level 2.0

Creates a HtcAlertDialog with the arguments supplied to this builder and show()'s the dialog.