I understand that there is this documentation
http://developer.android.com/reference/android/app/DialogFragment.html#AlertDialog
but as a new Android/Java le
Example of DialogFragment using Sherlock
FragmentManager fm = getSherlockActivity().getSupportFragmentManager();
DialogFragment dialog = new DialogFragment(){
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
// Use the Builder class for convenient dialog construction
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder
.setTitle(getString(R.string.delete)+"?")
.setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// do something
}
})
.setNegativeButton(getString(android.R.string.cancel), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dismiss();
}
});
// Create the AlertDialog object and return it
return builder.create();
}
};
dialog.setCancelable(true);
dialog.show(fm, "DELETE_DIALOG_FRAGMENT");