Sub dialog_onpositive
Log("geht")
End Sub
Sub dialog_onpositive(action As string)
Log("geht")
End Sub
Sub Globals
Dim sd1 As MD_SingleChoiceDialog
Dim nUserChoice As Int
Dim MenuList As List
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Default Selected
nUserChoice = 2
MenuList.Initialize
MenuList.Add("Apple ")
MenuList.Add("Orange")
MenuList.Add("Grapes")
MenuList.Add("Pineapple")
MenuList.Add("Mango")
'Call the Sub
ShowSingleChoiceMenu
End Sub
Sub ShowSingleChoiceMenu
sd1.Initialize("sd1")
'The following will display the menu with the default selection pointing to the index value of nUserChoice
sd1.Show("List of Fruits",MenuList,nUserChoice,"OK","Cancel")
End Sub
Sub sd1_SingleChoice(Index As Int,Text As String)
nUserChoice = Index
Select Index
Case 0
Case 1
Case 2
Case 3
Case 4
End Select
End Sub
Sub Globals
Dim sd1 as MaterialDialog
End Sub
Sub Activity_Create(FirstTime As Boolean)'Default Selected nUserChoice = 2
'Call the Sub ShowSingleChoiceMenu
ShowSingleChoiceMenu
End Sub
Sub ShowSingleChoiceMenu
sdi.Initialize("sd1")
sd1.items(Array As String("Apple", "Orange", "Grapes","Pineapple","Mango" ))
sd1.title("List of Fruits")
sd1.positiveText("OK")
sd1.negativeText("Cancel")
'sd1.autoDismiss(False)
sd1.itemsCallbackSingleChoice(0) 'Default Selected Item
sd1.show
End Sub
'The following event is not fired
Sub sd1_onSingleChoiceSelect (v As View, index As Int, text As String)
Msgbox(text &CRLF& index,"" )
End Sub
#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#AdditionalJar: android-support-v4
#AdditionalRes: $AndroidSDK$\extras\android\support\v7\appcompat\res, android.support.v7.appcompat
#AdditionalRes: $AdditionalLibs$\b4a_appcompat, de.amberhome.objects.appcompat
#End Region
#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 dialog As MaterialDialog
Private Button1 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("Layout1")
dialog.Initialize("Dialog")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
Log("Button_Click")
dialog.positiveText("Cool!").negativeText("Oh nooo").neutralText("I dont care").positiveColor(Colors.Green).neutralColor(Colors.Magenta).negativeColor(Colors.Red).title("DonManfred presents").content("afollestad´s MaterialDialogs").iconRes("donmanfred").dividerColor(Colors.Cyan).autoDismiss(False).buttonRippleColor(Colors.Gray).show
End Sub
** Activity (main) Resume **
Button_Click
main_button1_click (java line: 354)
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:1136)
at android.content.res.Resources.getDrawable(Resources.java:711)
at android.support.v4.content.res.ResourcesCompat.getDrawable(ResourcesCompat.java:53)
at com.afollestad.materialdialogs.MaterialDialog$Builder.iconRes(MaterialDialog.java:669)
at de.donmanfred.MaterialDialogBuilder.iconRes(MaterialDialogBuilder.java:358)
at b4a.example.materialdialog.main._button1_click(main.java:354)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:157)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:78)
at android.view.View.performClick(View.java:4584)
at android.view.View$PerformClick.run(View.java:18568)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5214)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:814)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:630)
at dalvik.system.NativeStart.main(Native Method)
Thanks! Working fine.Delete .iconRes("donmanfred") this Icon is not in the Example
You can set the Buttons gravityHow to set item's gravity ?
dialog.buttonsGravity(gravity As GravityEnum)
dialog.contentGravity(gravity As GravityEnum)
I can't understand!dialog.contentGravity(gravity As GravityEnum)
Dim DL As MaterialDialog ' in Globals
Sub lboeffnen_Click
If manager.GetBoolean("vibrate") = True Then
mv.vibrateOnce(40)
End If
DL.Initialize("dl1")
DL.items(Array As String("1", "2", "3", "4"))
DL.title("Bitte auswählen!!")
DL.positiveText("OK")
DL.negativeText("Schliessen")
DL.itemsCallbackSingleChoice(0)
DL.show
End Sub
Sub dl1_onSingleChoiceSelect(v As View, index As Int, text As String)
lboeffnenText = text
End Sub
Have you been able to find and rectify the issue please?selection methods does not work it seems. Need to check it when i have time