You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library is a collection of simple view helpers to make Android development easier. Right now, this library just has a few helpful classes but they will expand over time.
4
+
5
+
## SimpleAlertDialog
6
+
7
+
This is a simple way to bring up a modal alert dialog within a DialogFragment within a FragmentActivity. The dialog fragment used is the `v4.support` Fragment to support all Android versions.
8
+
9
+
### Usage
10
+
11
+
Creating an alert to display is easy:
12
+
13
+
```java
14
+
classMyActivityextendsFragmentActivity {
15
+
publicvoidshowDialog() {
16
+
SimpleAlertDialog.build(this,
17
+
"Sure you want to continue?", newSimpleAlertListener() {
18
+
@Override
19
+
publicvoidonPositive() {
20
+
// handle OK
21
+
}
22
+
23
+
@Override
24
+
publicvoidonNegative() {
25
+
// handle cancel
26
+
}
27
+
}
28
+
).show();
29
+
}
30
+
}
31
+
```
32
+
33
+
By default, this will display the following alert:
34
+
35
+

36
+
37
+
You can also adjust the alert to include no buttons, or change the button text.
38
+
To display just an "Sure" button:
39
+
40
+
```java
41
+
SimpleAlertDialog.build(this,
42
+
"Sure you want to continue?", "Sure", null, newSimpleAlertListener()
43
+
).show();
44
+
```
45
+
46
+
To display a "Yes" and "No" button:
47
+
48
+
```java
49
+
SimpleAlertDialog.build(this,
50
+
"Sure you want to continue?", "Yes", "No", newSimpleAlertListener()
51
+
).show();
52
+
```
53
+
54
+
You can also customize the icon in the alert and other properties:
0 commit comments