Android Question Spinner with csbilder-Text

FrankDev

Active Member
Licensed User
Longtime User
I have several entries in a spinner (combobox) ACSpinner that have been formatted with csbilder.

If I now want to read an entry with 'cmbRabattTyp.SelectedItem' I get the following error message.


com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045):
java.lang.ClassCastException: anywheresoftware.b4a.objects.CSBuilder$1 cannot be cast to java.lang.String
    at de.amberhome.objects.appcompat.ACSpinnerWrapper.getSelectedItem(ACSpinnerWrapper.java:137)
    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:348)
    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:197)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:193)
    at anywheresoftware.b4a.objects.ViewWrapper$1.onClick(ViewWrapper.java:80)
    at android.view.View.performClick(View.java:7753)
    at android.view.View.performClickInternal(View.java:7730)
    at android.view.View.access$3700(View.java:861)
    at android.view.View$PerformClick.run(View.java:29136)
    at android.os.Handler.handleCallback(Handler.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:210)
    at android.os.Looper.loop(Looper.java:299)
    at android.app.ActivityThread.main(ActivityThread.java:8105)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:556)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1045)

the text I read back is csbuilder formatted and cannot be read into a string variable.

I have already tried it with object, but have not got any further either
 

Sagenut

Expert
Licensed User
Longtime User
Post a small sample project if possible.
 
Upvote 0

FrankDev

Active Member
Licensed User
Longtime User
I have now solved this differently

B4X:
lstSpinner =  Array("5", "10", "25", "100", "150", "200", "250")
For i = 0 To lstSpinner.Size - 1
    Spinner.Add(Set_CS(lstSpinner.Get(i),Colors.RGB(61,43,83)))
Next
Spinner.SelectedIndex = 3
 
Upvote 0
Top