public class

HtcAlertDialog

extends Dialog
implements DialogInterface
java.lang.Object
   ↳ android.app.Dialog
     ↳ com.htc.widget.HtcAlertDialog
Known Direct Subclasses

Class Overview

A subclass of Dialog that can display one, two or three buttons. If you only want to display a String in this dialog box, use the setMessage() method. If you want to display a more complex view, look up the FrameLayout called "body" and add your view to it:

 FrameLayout fl = (FrameLayout) findViewById(R.id.body);
 fl.add(myView, new LayoutParams(FILL_PARENT, WRAP_CONTENT));
 

The AlertDialog class takes care of automatically setting WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM for you based on whether any views in the dialog return true from View.onCheckIsTextEditor(). Generally you want this set for a Dialog without text editors, so that it will be placed on top of the current input method UI. You can modify this behavior by forcing the flag to your desired mode after calling onCreate(Bundle).

Summary

Nested Classes
class HtcAlertDialog.Builder  
[Expand]
Inherited Constants
From interface android.content.DialogInterface
Fields
protected HtcAlertController mAlert
[Expand]
Inherited Fields
From class android.app.Dialog
Protected Constructors
HtcAlertDialog(Context context)
HtcAlertDialog(Context context, int theme)
HtcAlertDialog(Context context, boolean cancelable, DialogInterface.OnCancelListener cancelListener)
Public Methods
Button getButton(int whichButton)
Gets one of the buttons used in the dialog.
ListView getListView()
Gets the list view used in the dialog.
View getPadding1()
This is to get the padding view between each button.
View getPadding2()
This is to get the padding view between each button.
View getPadding3()
This is to get the padding view between each button.
boolean onKeyDown(int keyCode, KeyEvent event)
boolean onKeyUp(int keyCode, KeyEvent event)
void onWindowFocusChanged(boolean hasFocus)
void setButton(int whichButton, CharSequence text, Message msg)
Sets a message to be sent when a button is pressed.
void setButton(CharSequence text, Message msg)
This method is deprecated. Use setButton(int, CharSequence, Message) with BUTTON_POSITIVE.
void setButton(int whichButton, CharSequence text, DialogInterface.OnClickListener listener)
Sets a listener to be invoked when the positive button of the dialog is pressed.
void setButton(CharSequence text, DialogInterface.OnClickListener listener)
void setButton2(CharSequence text, Message msg)
This method is deprecated. Use setButton(int, CharSequence, Message) with BUTTON_NEGATIVE.
void setButton2(CharSequence text, DialogInterface.OnClickListener listener)
void setButton3(CharSequence text, DialogInterface.OnClickListener listener)
void setButton3(CharSequence text, Message msg)
This method is deprecated. Use setButton(int, CharSequence, Message) with BUTTON_NEUTRAL.
void setCustomTitle(View customTitleView)
void setIcon(Drawable icon)
void setIcon(int resId)
Sets resId to 0 if you don't want an icon.
void setInverseBackgroundForced(boolean forceInverseBackground)
void setIsAutoMotive(boolean isAutoMotive)
This method is deprecated. call HtcAlertDialogBuilder.setIsAutoMotive()
void setMessage(CharSequence message, int nAutoLinkMask)
void setMessage(CharSequence message)
void setTitle(CharSequence title)
void setView(View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom)
Sets the view to display in that dialog, specifying the spacing to appear around that view.
void setView(View view)
Sets the view to display in that dialog.
Protected Methods
void onCreate(Bundle savedInstanceState)
void onStart()
void onStartNonSIP()
void onStop()
[Expand]
Inherited Methods
From class android.app.Dialog
From class java.lang.Object
From interface android.content.DialogInterface
From interface android.view.KeyEvent.Callback
From interface android.view.PenManager.PenCallback
From interface android.view.View.OnCreateContextMenuListener
From interface android.view.Window.Callback

Fields

protected HtcAlertController mAlert

Since: API Level 2.0

Protected Constructors

protected HtcAlertDialog (Context context)

Since: API Level 2.0

protected HtcAlertDialog (Context context, int theme)

Since: API Level 2.0

protected HtcAlertDialog (Context context, boolean cancelable, DialogInterface.OnCancelListener cancelListener)

Since: API Level 2.0

Public Methods

public Button getButton (int whichButton)

Since: API Level 2.0

Gets one of the buttons used in the dialog.

If a button does not exist in the dialog, null will be returned.

Parameters
whichButton The identifier of the button that should be returned. For example, this can be BUTTON_POSITIVE.
Returns
  • The button from the dialog, or null if a button does not exist.

public ListView getListView ()

Since: API Level 2.0

Gets the list view used in the dialog.

Returns

public View getPadding1 ()

This is to get the padding view between each button. This function must be call after show() and remember to check null.

public View getPadding2 ()

This is to get the padding view between each button. This function must be call after show() and remember to check null.

public View getPadding3 ()

This is to get the padding view between each button. This function must be call after show() and remember to check null.

public boolean onKeyDown (int keyCode, KeyEvent event)

Since: API Level

public boolean onKeyUp (int keyCode, KeyEvent event)

Since: API Level

public void onWindowFocusChanged (boolean hasFocus)

Since: API Level

public void setButton (int whichButton, CharSequence text, Message msg)

Since: API Level 2.0

Sets a message to be sent when a button is pressed.

Parameters
whichButton Which button to set the message for, can be one of BUTTON_POSITIVE, BUTTON_NEGATIVE, or BUTTON_NEUTRAL
text The text to display in positive button.
msg The Message to be sent when clicked.

public void setButton (CharSequence text, Message msg)

Since: API Level 2.0

This method is deprecated.
Use setButton(int, CharSequence, Message) with BUTTON_POSITIVE.

public void setButton (int whichButton, 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
whichButton Which button to set the listener on, can be one of BUTTON_POSITIVE, BUTTON_NEGATIVE, or BUTTON_NEUTRAL
text The text to display in positive button.
listener The DialogInterface.OnClickListener to use.

public void setButton (CharSequence text, DialogInterface.OnClickListener listener)

Since: API Level 2.0

This method is deprecated.
Use setButton(int, CharSequence, android.content.DialogInterface.OnClickListener) with BUTTON_POSITIVE

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

Parameters
text The text to display in button 1.
listener The DialogInterface.OnClickListener to use.

public void setButton2 (CharSequence text, Message msg)

Since: API Level 2.0

This method is deprecated.
Use setButton(int, CharSequence, Message) with BUTTON_NEGATIVE.

public void setButton2 (CharSequence text, DialogInterface.OnClickListener listener)

Since: API Level 2.0

This method is deprecated.
Use setButton(int, CharSequence, android.content.DialogInterface.OnClickListener) with BUTTON_NEGATIVE

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

Parameters
text The text to display in button 2.
listener The DialogInterface.OnClickListener to use.

public void setButton3 (CharSequence text, DialogInterface.OnClickListener listener)

Since: API Level 2.0

This method is deprecated.
Use setButton(int, CharSequence, android.content.DialogInterface.OnClickListener) with BUTTON_POSITIVE

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

Parameters
text The text to display in button 3.
listener The DialogInterface.OnClickListener to use.

public void setButton3 (CharSequence text, Message msg)

Since: API Level 2.0

This method is deprecated.
Use setButton(int, CharSequence, Message) with BUTTON_NEUTRAL.

public void setCustomTitle (View customTitleView)

Since: API Level 2.0

public void setIcon (Drawable icon)

Since: API Level 2.0

public void setIcon (int resId)

Since: API Level 2.0

Sets resId to 0 if you don't want an icon.

Parameters
resId The resourceId of the drawable to use as the icon or 0 if you don't want an icon.

public void setInverseBackgroundForced (boolean forceInverseBackground)

Since: API Level 2.0

public void setIsAutoMotive (boolean isAutoMotive)

Since: API Level 4.8

This method is deprecated.
call HtcAlertDialogBuilder.setIsAutoMotive()

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 void setMessage (CharSequence message, int nAutoLinkMask)

Since: API Level 2.0

public void setMessage (CharSequence message)

Since: API Level 2.0

public void setTitle (CharSequence title)

Since: API Level

public void setView (View view, int viewSpacingLeft, int viewSpacingTop, int viewSpacingRight, int viewSpacingBottom)

Since: API Level 2.0

Sets the view to display in that dialog, specifying the spacing to appear around that view.

Parameters
view The view to show in the content area of the dialog
viewSpacingLeft Extra space to appear to the left of view
viewSpacingTop Extra space to appear above view
viewSpacingRight Extra space to appear to the right of view
viewSpacingBottom Extra space to appear below view

public void setView (View view)

Since: API Level 2.0

Sets the view to display in that dialog.

Protected Methods

protected void onCreate (Bundle savedInstanceState)

Since: API Level

protected void onStart ()

Since: API Level

protected void onStartNonSIP ()

Since: API Level 2.0

protected void onStop ()

Since: API Level