I am currently using an AlertDialog to create a simple dialog in my application. The code I am using looks like this:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setCancelable(false);
builder.setTitle(DialogTitle);
builder.setItems(R.array.options, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which) {
case 0:
reset();
break;
case 1:
exit();
break;
default:
break;
}
}
});
builder.show();
I have read that the best option may be to create a class that extends DialogFragment and then use my DialogFragment instead of my current implementation.
Can anyone confirm that this is the best solution, suggest something better and possibly give me an example?
Thank you.