Skip to content

Instantly share code, notes, and snippets.

@TigerWolf
Created February 18, 2015 23:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TigerWolf/2ff0586e99fa8a79c738 to your computer and use it in GitHub Desktop.
Save TigerWolf/2ff0586e99fa8a79c738 to your computer and use it in GitHub Desktop.
class AlertHelper
def initialize(activity, listener = nil)
@activity = activity
@listener = listener
@listener = self if listener.nil?
@ok = false
end
def dialog(title, message)
r_string_yes = 17039379
r_string_no = 17039369
ab = Android::App::AlertDialog::Builder.new(@activity)
.setTitle(title)
.setMessage(message)
.setPositiveButton(r_string_yes, @listener)
.setCancelable(false)
if @ok == true
ab.setNegativeButton(r_string_no, @listener)
else
end
ab.show
end
def ok=(bool)
@ok = bool
end
def onClick(dialog, which)
end
end
@colinta
Copy link

colinta commented Feb 19, 2015

Do you have any more cool helpers for Android? I'd love to see some code make its way into SugarCube's Android support! 😃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment