Android Tutorial [B4X] [XUI] Msgbox

XUI library v1.4 adds support for asynchronous msgbox dialogs.

The API is simple:

SS-2017-10-19_15.27.39.png


B4X:
xui.MsgboxAsync("Hello", "World")

The dialog is not a modal dialog. The code will not stop.
MsgboxAsync and Msgbox2Async return an object that can be used as the sender filter parameter in a Wait For call.
To wait for the dialog to being dismissed:
B4X:
Wait For (xui.MsgboxAsync("Hello", "World")) Msgbox_Result (Result As Int)

Msgbox2Async provides more options:
SS-2017-10-19_15.35.48.png
SS-2017-10-19_15.38.01.png
SS-2017-10-19_15.38.42.png

B4X:
Dim icon As B4XBitmap = xui.LoadBitmapResize(File.DirAssets, "warning.png", 60dip, 60dip, True)
Dim sf As Object = xui.Msgbox2Async("Delete file?", "Title", "Yes", "Cancel", "No", icon)
Wait For (sf) Msgbox_Result (Result As Int)
If Result = xui.DialogResponse_Positive Then
   Log("Deleted!!!")
End If

You can pass Null instead of the image.
You can pass "" (empty string) to remove buttons.

Note that the icon parameter is not used in B4i.
 

ivan.tellez

Active Member
Licensed User
Longtime User
This is really usefull, iths a great Native replacement for Corwin42's Material dialogs in B4A But cross platform.

Can you please add more dialogs similar to te ones on Corwins42 lib?

Specialy Progress dialog to replace ProgressDialogShow, and iHUD And and imputdialog, to avoid custom dialogs

Thanks
 
Top