B4A Library Spinner Wheel - Vertical and Horizontal (24 June: new lib files in post #47)

Anser

Well-Known Member
Licensed User
Any hint, why I am getting the following run time error.

B4X:
** Service (starter) Create **
Starter Service Create
** Service (starter) Start **
Starter Service Start
** Activity (main) Create, isFirst = true **
anserkk@gmail.com
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Activity (homepage) Pause, UserClosed = false **
** Activity (insurancerenewal) Create, isFirst = true **
radius:2.0
elevation:2.0
** Activity (insurancerenewal) Resume **
java.lang.NullPointerException
    at main.java.antistatic.spinnerwheel.adapters.ArrayWheelAdapter.getItemsCount(ArrayWheelAdapter.java:63)
    at main.java.antistatic.spinnerwheel.AbstractWheel.getItemsRange(AbstractWheel.java:809)
    at main.java.antistatic.spinnerwheel.AbstractWheel.rebuildItems(AbstractWheel.java:744)
    at main.java.antistatic.spinnerwheel.WheelVerticalView.onMeasure(WheelVerticalView.java:236)
    at android.view.View.measure(View.java:16497)
    at android.view.ViewGroup.measureChild(ViewGroup.java:5096)
    at android.view.ViewGroup.measureChildren(ViewGroup.java:5073)
    at anywheresoftware.b4a.BALayout.onMeasure(BALayout.java:64)
    at android.view.View.measure(View.java:16497)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    at android.support.v7.widget.CardView.onMeasure(CardView.java:197)
    at android.view.View.measure(View.java:16497)
    at android.view.ViewGroup.measureChild(ViewGroup.java:5096)
    at android.view.ViewGroup.measureChildren(ViewGroup.java:5073)
    at anywheresoftware.b4a.BALayout.onMeasure(BALayout.java:64)
    at android.view.View.measure(View.java:16497)
    at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1226)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    at android.widget.ScrollView.onMeasure(ScrollView.java:326)
    at android.view.View.measure(View.java:16497)
    at android.view.ViewGroup.measureChild(ViewGroup.java:5096)
    at android.view.ViewGroup.measureChildren(ViewGroup.java:5073)
    at anywheresoftware.b4a.BALayout.onMeasure(BALayout.java:64)
    at android.view.View.measure(View.java:16497)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    at android.support.v7.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:135)
    at android.view.View.measure(View.java:16497)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
    at android.view.View.measure(View.java:16497)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    at android.view.View.measure(View.java:16497)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
    at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
    at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
    at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
    at android.view.View.measure(View.java:16497)
    at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
    at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
    at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
    at android.view.View.measure(View.java:16497)
    at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1912)
    at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1109)
    at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1291)
    at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
    at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
    at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
    at android.view.Choreographer.doCallbacks(Choreographer.java:574)
    at android.view.Choreographer.doFrame(Choreographer.java:544)
    at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
    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:5001)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodA
Message longer than Log limit (4000). Message was truncated.
 

Anser

Well-Known Member
Licensed User
I am experiencing very strange behaviors in my App if I use this Spinner-Wheel Lib.

One of the reasons for the above error described in my previous post was because of the sequence of the commands given. For eg the following sequence should be followed or else I get the above error described in my previous post.

For eg. I assigned WheelVerticalView1.SelectedIndex before WheelVerticalView1.setupSpinnerWheel
B4X:
WheelVerticalView1.SpinnerItems = months
WheelVerticalView1.SelectedIndex = 1 
WheelVerticalView1.setupSpinnerWheel
The right way is
B4X:
WheelVerticalView1.SpinnerItems = months
WheelVerticalView1.setupSpinnerWheel   
WheelVerticalView1.SelectedIndex = 1
I don't know whether the error message was misleading or not.

I still get the same error message whenever WheelVerticalView fails

Now let me describe the core issue that I experience right now when I tested this lib. I have an activity and it has just one view placed on it via designer ie WheelVerticalView1. The below is the B4A code. The code itself is self explanatory with proper comments on it.

B4X:
#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.
    Private reqManager As DBRequestManager
    Private WheelVerticalView1 As WheelVerticalView
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("Test")
    If FirstTime Then
        reqManager.Initialize(Me, Starter.RdcServerIP) ' The IP of the machine running JAVASERVER
    Else
        If reqManager.IsInitialized = False Then
            reqManager.Initialize(Me, Starter.RdcServerIP) ' The IP of the machine running JAVASERVER
        End If       
    End If       
   
    'The next sub works fine. It displays the Wheel perfectly.
    ' But if I comment this call to the Sub TestWheel from Activity Create aand call frrom some other place
    ' then  the app will Force quit abnormally
   
    'TestWheel  'Call TestWheel sub
   
    ' The app is supposed to fill the data in the WheelView from a Remote Table. So get the data from the Remote Table
    ' and fill the WheelView using the following Sub ie GetVehicleModels
    ' To test the problem, comment the above call to the Sub TestWheel and uncomment the next statement
    ' ie GetItemDetails
    '
    GetItemDetails  'This will not work.
   
End Sub

Sub TestWheel
    Dim months() As String
    months = Array As String("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")
    WheelVerticalView1.SpinnerItems = months
    WheelVerticalView1.setupSpinnerWheel   
    WheelVerticalView1.SelectedIndex = 1   
End Sub

Sub Activity_Resume
    If reqManager.IsInitialized = False Then
        reqManager.Initialize(Me, Starter.RdcServerIP) ' The IP of the machine running JAVASERVER
    End If
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub GetItemDetails
    Log("Log : Inside GetItemDetails")
   
    Dim cmd As DBCommand
    cmd.Initialize
    cmd.Name="GetItemDtls"
    Log("Log : About to execute reqmanager")
   
    ' If I have WheelView then the app WILL NOT EXECUTE BEYOND THIS POINT. It will raise the error
    ' If I   R E M O V E   the WheelView then it works fine and the JobDone is Executed   
   
    Try
        reqManager.ExecuteQuery(cmd, 0, "ItemDetailsList")
    Catch
        Msgbox("Could not establish connection with the server","Check Internet")
    End Try           
End Sub

Sub JobDone(Job As HttpJob)
    ProgressDialogHide
  If Job.Success = False Then
     Log("Error: " & Job.ErrorMessage)
  Else
    If Job.JobName = "DBRequest" Then
            reqManager.HandleJobAsync(Job, "ReqManager")
        End If
    End If
    Job.Release
End Sub

Sub ReqManager_Result(result As DBResult)
    Log("Log : Inside ReqManagerResult")
    reqManager.PrintTable(result)

    If result.Tag = "ItemDetailsList" Then
        Log("Log : Inside ReqManagerResult")
        AddData2WheelView(result)       
    End If
End Sub       

Sub AddData2WheelView(result As DBResult)
    Log("Log : Inside AddData2WheelView")

    'Actually here I am supposed to fill data to the WheelView. As the WheelView is not working and
    'to demonstrate the problem, I am calling the Sub TestWheel from here

    TestWheel
End Sub

I get the following error

** Activity (homepage) Pause, UserClosed = false **
** Activity (test) Create, isFirst = true **
Log : Inside GetItemDetails
Log : About to execute reqmanager
** Activity (test) Resume **
java.lang.NullPointerException
at main.java.antistatic.spinnerwheel.adapters.ArrayWheelAdapter.getItemsCount(ArrayWheelAdapter.java:63)
at main.java.antistatic.spinnerwheel.AbstractWheel.getItemsRange(AbstractWheel.java:809)
at main.java.antistatic.spinnerwheel.AbstractWheel.rebuildItems(AbstractWheel.java:744)
at main.java.antistatic.spinnerwheel.WheelVerticalView.onMeasure(WheelVerticalView.java:236)
at android.view.View.measure(View.java:16497)
at android.view.ViewGroup.measureChild(ViewGroup.java:5096)
at android.view.ViewGroup.measureChildren(ViewGroup.java:5073)
at anywheresoftware.b4a.BALayout.onMeasure(BALayout.java:64)
at android.view.View.measure(View.java:16497)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:16497)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1404)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:695)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:16497)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5125)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2291)
at android.view.View.measure(View.java:16497)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1912)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1109)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1291)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:996)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5600)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
at android.view.Choreographer.doCallbacks(Choreographer.java:574)
at android.view.Choreographer.doFrame(Choreographer.java:544)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
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:5001)
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:785)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
at dalvik.system.NativeStart.main(Native Method)


Any help will be appreciated

Regards
Anser
 

Anser

Well-Known Member
Licensed User
Resolved.

You need the following lines before you do anything with wheelview

WheelVerticalView1.SpinnerItems = Array As String()
WheelVerticalView1.setupSpinnerWheel

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Test")
    If FirstTime Then
        reqManager.Initialize(Me, Starter.RdcServerIP) ' The IP of the machine running JAVASERVER
    Else
        If reqManager.IsInitialized = False Then
            reqManager.Initialize(Me, Starter.RdcServerIP) ' The IP of the machine running JAVASERVER
        End If    
    End If    

    'The following lines are mandatory
    WheelVerticalView1.SpinnerItems = Array As String()
    WheelVerticalView1.setupSpinnerWheel

    GetItemDetails  

End Sub
Regards
Anser
 

Anser

Well-Known Member
Licensed User
Hi,

Is there a possibility to display the spinner contents Horizontally left aligned OR right aligned. ?
  • As of now the contents of the spinner appear center aligned
Is there a possibility to change the typeface of the spinner contents ?
  • As of now it is in Bold Typeface
Regards
Anser
 

Johan Schoeman

Expert
Licensed User
Hi,

Is there a possibility to display the spinner contents Horizontally left aligned OR right aligned. ?
  • As of now the contents of the spinner appear center aligned
Is there a possibility to change the typeface of the spinner contents ?
  • As of now it is in Bold Typeface
Regards
Anser
I will amend the code to allow for it. Will post it sometime this coming weekend.
 

Johan Schoeman

Expert
Licensed User
Hi,

Is there a possibility to display the spinner contents Horizontally left aligned OR right aligned. ?
  • As of now the contents of the spinner appear center aligned
Is there a possibility to change the typeface of the spinner contents ?
  • As of now it is in Bold Typeface
Regards
Anser
The attached library files takes care of it (for the vertical spinner). Use it in your code as follows:
B4X:
vsw2.TextGravity = vsw2.GRAVITY_LEFT       'or GRAVITY_CENTER or GRAVITY_RIGHT
vsw2.TextTypeface = vsw2.TYPEFACE_NORMAL   'or TYPEFACE_BOLD or TYPEFACE_BOLD_ITALIC or TYPEFACE_ITALIC
 

Attachments

victormedranop

Well-Known Member
Licensed User
I have an issue with
WheelHorizontalImageView1


got error android.content.res.Resources$NotFoundException: Resource ID #0x0
 

Johan Schoeman

Expert
Licensed User
I have an issue with
WheelHorizontalImageView1


got error android.content.res.Resources$NotFoundException: Resource ID #0x0
You should have 5 files in the /Objects/res/drawable folder of the B4A project. Do you have them?
divider_dark_gradient_horizontal.xml
icon.png
wheel_bg_hor.xml
wheel_bg_ver.xml
wheel_val.xml


You should also have one file in the /Object/res/values folder of the B4A project. Do you have it?
wheel__attrs.xml

If not, then the utility program that you have used to extract the zipped B4A project has removed the READ ONLY properties of these files. Make sure that once you have unzipped the B4A project that these files are set to READ ONLY before you run the B4A project for the first time else these files will be deleted when you compile the B4A code.
 

LordZenzo

Well-Known Member
Licensed User
the example of the first post works, if I add a WheelVerticalView to my project I get this, why?

** Activity (main) Create, isFirst = true **
Error occurred on line: 38 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at Cronos.gi.lo.main.afterFirstLayout(main.java:102)
at Cronos.gi.lo.main.access$000(main.java:17)
at Cronos.gi.lo.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 20 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:2358)
at android.content.res.Resources.getDrawable(Resources.java:1863)
at android.content.res.Resources.getDrawable(Resources.java:1831)
at androidspinnerwheelwrapper.androidVerticalWheelWrapper.updateSpinner(androidVerticalWheelWrapper.java:106)
at androidspinnerwheelwrapper.androidVerticalWheelWrapper.setupSpinnerWheel(androidVerticalWheelWrapper.java:91)
at androidspinnerwheelwrapper.androidVerticalWheelWrapper._initialize(androidVerticalWheelWrapper.java:66)
... 24 more
** Activity (main) Resume **
 

Johan Schoeman

Expert
Licensed User
the example of the first post works, if I add a WheelVerticalView to my project I get this, why?

** Activity (main) Create, isFirst = true **
Error occurred on line: 38 (Main)
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:166)
at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:209)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:708)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:340)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:247)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at Cronos.gi.lo.main.afterFirstLayout(main.java:102)
at Cronos.gi.lo.main.access$000(main.java:17)
at Cronos.gi.lo.main$WaitForLayout.run(main.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:64)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
... 20 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.Resources.getValue(Resources.java:2358)
at android.content.res.Resources.getDrawable(Resources.java:1863)
at android.content.res.Resources.getDrawable(Resources.java:1831)
at androidspinnerwheelwrapper.androidVerticalWheelWrapper.updateSpinner(androidVerticalWheelWrapper.java:106)
at androidspinnerwheelwrapper.androidVerticalWheelWrapper.setupSpinnerWheel(androidVerticalWheelWrapper.java:91)
at androidspinnerwheelwrapper.androidVerticalWheelWrapper._initialize(androidVerticalWheelWrapper.java:66)
... 24 more
** Activity (main) Resume **
See the folder structure of the B4A project - you are missing resources from your project that should be in the /Objects/res folder of the B4A project and in all probability not set to READ ONLY when you compile the B4A project - they will be deleted during compilation if not set to READ ONLY or you will get the error if they were not there at all
 

LordZenzo

Well-Known Member
Licensed User
See the folder structure of the B4A project - you are missing resources from your project that should be in the /Objects/res folder of the B4A project and in all probability not set to READ ONLY when you compile the B4A project - they will be deleted during compilation if not set to READ ONLY or you will get the error if they were not there at all
but as you can if the error only appears in layount inserting an object WheelVerticalView?
the project works perfectly without
 

Schakalaka

Active Member
Licensed User
Hello,
i have change the code for mae my app multilanguage but i don' t know who i can do that on value change i'll whrite on txt the value index of the selected language..
i post my code:

B4X:
#Region  Activity Attributes
    #FullScreen: True
    #IncludeTitle: False
#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.

    Private backgroundImage As ImageView
    Private languageLabel As Label
    
    
    Private titleImage As ImageView
    
    Dim myImage As Bitmap

    
    Private langChanger As WheelVerticalImageView
    
    Dim countriesIt() As String
    Dim countriesEn() As String
    Dim countriesEs() As String
    Dim countriesDe() As String
    Dim countriesFr() As String
    Dim loadFromList As Boolean = True
    
    Private okButton As Button
    Dim countrystr As String
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("ChoseLanguage")
    
    langChanger.Color = Colors.Black
    
    Dim mylist As List
    mylist.Initialize
    mylist.Add(LoadBitmap(File.DirAssets,"flag_en.png"))             'add bitmaps to the list. They can come from anywhere
    mylist.Add(LoadBitmap(File.DirAssets,"flag_it.png"))
    mylist.Add(LoadBitmap(File.DirAssets,"flag_es.png"))
    mylist.Add(LoadBitmap(File.DirAssets,"flag_de.png"))
    mylist.Add(LoadBitmap(File.DirAssets,"flag_fr.png"))
    
    langChanger.ImageFromList = loadFromList
    
    countriesEn = Array As String (" English ", " Italian ", " Spanish ", " Deuch ", " Franch ")
    countriesIt = Array As String (" Inglese ", " Italiano ", " Spagnolo ", " Tedesco ", " Francese ")
    countriesEs = Array As String ("Inglés", "Italiano", "Español", "Alemán", "Francés")
    countriesDe = Array As String ("Englisch", "Italienisch", "Spanisch", "Deutsch", "Französisch")
    countriesFr = Array As String ("Anglais", "Italien", "Espagnol", "Allemand", "Français")
'   
    If Main.ListSettings(0) = "it" Then
        langChanger.SpinnerItems = countriesIt
    else if Main.ListSettings(0) = "en" Then
        langChanger.SpinnerItems = countriesEn
    Else If Main.ListSettings(0) = "es" Then
        langChanger.SpinnerItems = countriesEs
    else if Main.ListSettings(0) = "de" Then
        langChanger.SpinnerItems = countriesDe
    Else if Main.ListSettings(0) = "fr" Then
        langChanger.SpinnerItems = countriesFr
    Else
        langChanger.SpinnerItems = countriesEn
    End If
    
    
    langChanger.ImageBitmaps = mylist
    
    langChanger.SpinnerTextColor = Colors.Magenta
    langChanger.SpinnerTextSize = 30
    langChanger.setupSpinnerWheel
'    langChanger.SelectedIndex = 0
    
    SetLabelSize(languageLabel,"Please choose your language")
    languageLabel.Color = Colors.Black
    backgroundImage.Bitmap = LoadBitmap(File.DirAssets,"backgroundworld.png")
    titleImage.Bitmap = LoadBitmap(File.DirAssets,"title.png")
    SetButtonTextSize(okButton,"OK")
End Sub

Sub langChanger_value_changed(index As Int)
    
    countriesIt(0) = "Inglese"
    countriesIt(1) = "Italiano"
    countriesIt(2) = "Spagnolo"
    countriesIt(3) = "Tedesco"
    countriesIt(4) = "Francese"
'    If Main.ListSettings(0) ="it" Then
'   
'    countriesIt = Array As String (" Inglese ", " Italiano ", " Spagnolo ", " Tedesco ", " Francese ")
'        countrystr = countriesIt(index)
'    else if  Main.ListSettings(0) ="en" Then
'        countriesEn = Array As String (" English ", " Italian ", " Spanish ", " Deuch ", " Franch ")
'        countrystr = countriesEn(index)       
'    else if  Main.ListSettings(0) ="es" Then
'    countriesEs = Array As String ("Inglés", "Italiano", "Español", "Alemán", "Francés")
'        countrystr = countriesEs(index)
'    else if  Main.ListSettings(0) ="de" Then
'    countriesDe = Array As String ("Englisch", "Italienisch", "Spanisch", "Deutsch", "Französisch")
'        countrystr =     countriesDe(index)
'    Else
'    countriesFr = Array As String ("Anglais", "Italien", "Espagnol", "Allemand", "Français")
'        countriesFr(index)
'End If
'    countrystr = countriesIt(index)
    



    
End Sub




Sub okButton_Click
    File.WriteList(File.DirRootExternal,"WorldsCapitals/ListSettings.txt",Main.ListSettings)
     If countrystr = "Italiano" Then
        Main.ListSettings(0) ="it"
        File.WriteList(File.DirRootExternal,"WorldsCapitals/ListSettings.txt",Main.ListSettings)
        Main.language = "it"
    Else if countrystr = "Inglese" Then
        Main.ListSettings(0) ="en"
        File.WriteList(File.DirRootExternal,"WorldsCapitals/ListSettings.txt",Main.ListSettings)
        Main.language = "en"
    Else if countrystr = "Spagnolo" Then
        Main.ListSettings(0) ="es"
        File.WriteList(File.DirRootExternal,"WorldsCapitals/ListSettings.txt",Main.ListSettings)
        Main.language = "es"
    Else if countrystr = "Tedesco" Then
        Main.ListSettings(0) ="de"
        File.WriteList(File.DirRootExternal,"WorldsCapitals/ListSettings.txt",Main.ListSettings)
        Main.language = "de"
    Else
        Main.ListSettings(0) ="fr"
        File.WriteList(File.DirRootExternal,"WorldsCapitals/ListSettings.txt",Main.ListSettings)
        Main.language = "fr"
        
        
    End If
    
    StartActivity(Main)
    
End Sub
thanks for your help
 

eps

Well-Known Member
Licensed User
Many thanks for sharing this - I've popped it in to a game I've just released - well Beta released... Hopefully if it goes live and does 'well' I can send some funds your way OP!

:)
 

mkh_fx

Member
Licensed User
after update to version 1.01 get below error message

B4X:
** Activity (home) Pause, UserClosed = false **
** Activity (selectdate) Create, isFirst = true **
Class not found: androidspinnerwheelwrapper.androidSpinnerWheelWrapper, trying: org.rahbord.witrip.androidSpinnerWheelWrapper
Error occurred on line: 60 (selectDate)
java.lang.RuntimeException: java.lang.ClassNotFoundException: org.rahbord.witrip.androidSpinnerWheelWrapper
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:180)
    at anywheresoftware.b4a.debug.Debug.delegate(Debug.java:262)
    at org.rahbord.witrip.selectdate._loadlayout(selectdate.java:397)
    at org.rahbord.witrip.selectdate._activity_create(selectdate.java:376)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
    at org.rahbord.witrip.selectdate.afterFirstLayout(selectdate.java:104)
    at org.rahbord.witrip.selectdate.access$000(selectdate.java:17)
    at org.rahbord.witrip.selectdate$WaitForLayout.run(selectdate.java:82)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:214)
    at android.app.ActivityThread.main(ActivityThread.java:7050)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by: java.lang.ClassNotFoundException: org.rahbord.witrip.androidSpinnerWheelWrapper
    at java.lang.Class.classForName(Native Method)
    at java.lang.Class.forName(Class.java:453)
    at java.lang.Class.forName(Class.java:378)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:390)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayoutHelper(LayoutBuilder.java:454)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:148)
    ... 27 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.rahbord.witrip.androidSpinnerWheelWrapper" on path: DexPathList[[zip file "/system/framework/org.apache.http.legacy.boot.jar", zip file "/data/app/org.rahbord.witrip-QBJiqLmQ_48LLLsBrRnBbw==/base.apk"],nativeLibraryDirectories=[/data/app/org.rahbord.witrip-QBJiqLmQ_48LLLsBrRnBbw==/lib/arm64, /system/lib64, /system/vendor/lib64]]
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
    ... 33 more
 
Top