Skip to content

Instantly share code, notes, and snippets.

@Hulzenga
Last active August 29, 2015 13:56
Show Gist options
  • Save Hulzenga/9003147 to your computer and use it in GitHub Desktop.
Save Hulzenga/9003147 to your computer and use it in GitHub Desktop.
private int popupStack = 0;
private boolean showingPopup = false;
public void showPopup() {
if (!showingPopup) {
showingPopup = true;
//if this isn't popup number 0 one should be eliminated from the stack
if (popupStack > 0) {
popupStack--;
}
final Dialog dialog = new Dialog(this) {
@Override
protected void onStop() {
super.onStop();
showingPopup = false;
if (popupStack > 0) {
showPopup();
}
}
};
dialog.setContentView(R.layout.pop_up);
dialog.setTitle("Not enough points");
dialog.show();
z = 1;
Button btnCancel = (Button) dialog.findViewById(R.id.cancel);
btnCancel.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
dialog.dismiss();
}
});
} else {
popupStack++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment