[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

sample[jx8-android] AlertDialog


SwikiCodeRobot @> #sampleJx8AndroidAlertDialog

"Show an alert dialog"
| builder dialog listener interface |
[  interface  :=
	(AlertDialog
		interface: #DialogInterface)
		declared: #OnClickListener.
listener := Java
	newProxy: interface
	functions: #onClick -> [:iDialog :id|
		self print: 'Clicked button ' ,id.
		iDialog cancel
	].
builder := AlertDialog builder fromMainContext.
builder
	message: 'This is an Alert';
	title: #Information;
	setPositiveButton: #close listener: listener;
	yourself.
dialog := builder create.
dialog show
] on: Error do: [:ex| self print: ex stack ]