Skip to content

Instantly share code, notes, and snippets.

@ninjayoto
Created June 9, 2016 09:44
Show Gist options
  • Select an option

  • Save ninjayoto/74bdc6a19ed246e4f5f8f42d3a6bc3de to your computer and use it in GitHub Desktop.

Select an option

Save ninjayoto/74bdc6a19ed246e4f5f8f42d3a6bc3de to your computer and use it in GitHub Desktop.
private AlertDialog showCustomDialog(final Activity act,
CharSequence title,
CharSequence message,
CharSequence buttonYes,
CharSequence buttonNo,
final int selectedIndex) {
AlertDialog.Builder customDialog = new AlertDialog.Builder(act);
customDialog.setTitle(title);
customDialog.setMessage(message);
//clicking the positive button
customDialog.setPositiveButton(buttonYes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int i) {
//Action performed on clicking the positive dialog button action
picURL.remove(selectedIndex);
}
});
//Clicking the negative button
customDialog.setNegativeButton(buttonNo, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialogInterface, int i) {
//Action performed on clicking the negative dialog button action
}
});
return customDialog.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment