#Region Project Attributes
#ApplicationLabel: b4aDynamicToast
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#AdditionalRes: ..\LibRes
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim dt As DynamicToast
Dim ct As CustomToast
Private btnError As Button
Private btnWarning As Button
Private btnSuccess As Button
Private btnInformation As Button
Private btnCustom As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("main")
dt.Initialize
ct.Initialize
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnError_Click
dt.ErrorMessageToast = "This is an error..."
End Sub
Sub btnWarning_Click
dt.WarningMessageToast = "This is a warning..."
End Sub
Sub btnSuccess_Click
dt.SuccessMessageToast = "This is a success..."
End Sub
Sub btnInformation_Click
dt.InformationMessageToast = "This is information..."
End Sub
Sub btnCustom_Click
ct.CustomMessageText = "custom toast message.."
ct.CustomMessageTextColor = Colors.White
ct.CustomMessageTextSize = 18
ct.setCustomMessageIcon(ct.icon_INFO, ct.icon_POSITION_LEFT)
ct.CustomMessageIconColor = Colors.White
ct.CustomMessageBackgroundColor = 0xFF853657
ct.CustomMessageBackgroundDrawable = ct.background_INFO
ct.CustomMessageDuration = ct.LENGTH_LONG
ct.setGravity(Gravity.CENTER,0,0)
'ct.CustomMessageTypeface = Typeface.LoadFromAssets("cambriai.ttf") 'Download cambria font if you want it (google search) and put it in "Files" folder
ct.CustomMessageTypeface = Typeface.CreateNew(Typeface.MONOSPACE,Typeface.STYLE_ITALIC)
ct.Show
End Sub