Please see the code below.
final CharSequence[] cs = DeviceList.toArray(new CharSequence[DeviceList.size()]);
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
builder.setTitle("Pick the Item");
builder.setItems(cs, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//do something
}
});
builder.show();
Some one please help me to implement a builder onDismissListener event in this code?
Here you go:
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
}
});
So, the complete code will be something like:
final CharSequence[] cs = DeviceList.toArray(new CharSequence[DeviceList.size()]);
AlertDialog.Builder builder = new AlertDialog.Builder(ctx);
builder.setTitle("Pick the Item");
builder.setItems(cs, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//do something
}
});
builder.setOnDismissListener(new DialogInterface.OnDismissListener() {
@Override
public void onDismiss(DialogInterface dialog) {
}
});
builder.show();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With