Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Constants](https://developer.android.com/reference/android/test/mock/MockDialogInterface#inhconstants) \| [Ctors](https://developer.android.com/reference/android/test/mock/MockDialogInterface#pubctors) \| [Methods](https://developer.android.com/reference/android/test/mock/MockDialogInterface#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/test/mock/MockDialogInterface#inhmethods)

# MockDialogInterface

*** ** * ** ***

` public class MockDialogInterface `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/content/DialogInterface `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.test.mock.MockDialogInterface |

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 24.**   

Use a mocking framework like [Mockito](https://github.com/mockito/mockito). New tests should be written using the [Android Testing Support Library](https://developer.android.com/tools/testing-support-library).

A mock `https://developer.android.com/reference/android/content/DialogInterface` class. All methods are non-functional and throw `https://developer.android.com/reference/java/lang/UnsupportedOperationException`. Override it to provide the operations that you need.

## Summary

### Inherited constants

From interface `https://developer.android.com/reference/android/content/DialogInterface` `int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON1`

*This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_POSITIVE`*
`int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON2`

*This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEGATIVE`*
`int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON3`

*This constant was deprecated in API level 15. Use `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEUTRAL`*
`int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEGATIVE`

The identifier for the negative button.
`int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_NEUTRAL`

The identifier for the neutral button.
`int` `https://developer.android.com/reference/android/content/DialogInterface#BUTTON_POSITIVE`

The identifier for the positive button.

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/test/mock/MockDialogInterface#MockDialogInterface()() ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/test/mock/MockDialogInterface#cancel()() ` Cancels the dialog, invoking the `https://developer.android.com/reference/android/content/DialogInterface.OnCancelListener`. |
| ` void` | ` https://developer.android.com/reference/android/test/mock/MockDialogInterface#dismiss()() ` Dismisses the dialog, invoking the `https://developer.android.com/reference/android/content/DialogInterface.OnDismissListener`. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/content/DialogInterface ` ` abstract void` ` https://developer.android.com/reference/android/content/DialogInterface#cancel()() `

Cancels the dialog, invoking the `https://developer.android.com/reference/android/content/DialogInterface.OnCancelListener`.
` abstract void` ` https://developer.android.com/reference/android/content/DialogInterface#dismiss()() `

Dismisses the dialog, invoking the `https://developer.android.com/reference/android/content/DialogInterface.OnDismissListener`.

## Public constructors

### MockDialogInterface

```
public MockDialogInterface ()
```

<br />

<br />

## Public methods

### cancel

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void cancel ()
```

Cancels the dialog, invoking the `https://developer.android.com/reference/android/content/DialogInterface.OnCancelListener`.

The `https://developer.android.com/reference/android/content/DialogInterface.OnDismissListener` may also be called if cancellation dismisses the dialog.

<br />

### dismiss

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void dismiss ()
```

Dismisses the dialog, invoking the `https://developer.android.com/reference/android/content/DialogInterface.OnDismissListener`.

<br />