Package org.robolectric.shadows
Class ShadowAlertDialog
java.lang.Object
org.robolectric.shadows.ShadowDialog
org.robolectric.shadows.ShadowAlertDialog
- Direct Known Subclasses:
ShadowDatePickerDialog
,ShadowProgressDialog
,ShadowTimePickerDialog
@Implements(android.app.AlertDialog.class) public class ShadowAlertDialog extends ShadowDialog
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ShadowAlertDialog.ShadowBuilder
-
Field Summary
-
Constructor Summary
Constructors Constructor Description ShadowAlertDialog()
-
Method Summary
Modifier and Type Method Description void
clickOnItem(int index)
Simulates a click on theDialog
item indicated byindex
.Adapter
getAdapter()
View
getCustomTitleView()
FrameLayout
getCustomView()
int
getIconId()
CharSequence[]
getItems()
static AlertDialog
getLatestAlertDialog()
CharSequence
getMessage()
CharSequence
getTitle()
View
getView()
static void
reset()
Resets the tracking of the most recently createdAlertDialog
void
show()
Methods inherited from class org.robolectric.shadows.ShadowDialog
callOnCreate, clickOn, clickOnText, clickOnText, dismiss, getLatestDialog, getOnCancelListener, getShownDialogs, hasBeenDismissed, isCancelable, isCancelableOnTouchOutside, setCanceledOnTouchOutside, setLatestDialog, setOnCancelListener
-
Constructor Details
-
ShadowAlertDialog
public ShadowAlertDialog()
-
-
Method Details
-
getLatestAlertDialog
- Returns:
- the most recently created
AlertDialog
, or null if none has been created during this test run
-
getCustomView
-
reset
Resets the tracking of the most recently createdAlertDialog
-
clickOnItem
public void clickOnItem(int index)Simulates a click on theDialog
item indicated byindex
. Handles both multi- and single-choice dialogs, tracks which items are currently checked and calls listeners appropriately.- Parameters:
index
- the index of the item to click on
-
getTitle
- Overrides:
getTitle
in classShadowDialog
-
getItems
- Returns:
- the items that are available to be clicked on
-
getAdapter
-
getMessage
- Returns:
- the message displayed in the dialog
-
show
public void show()- Overrides:
show
in classShadowDialog
-
getView
- Returns:
- the view set with
AlertDialog.Builder.setView(View)
-
getIconId
public int getIconId()- Returns:
- the icon set with
AlertDialog.Builder.setIcon(int)
-
getCustomTitleView
- Returns:
- return the view set with
AlertDialog.Builder.setCustomTitle(View)
-