Android Question Problem with Spinner and initialization

mrjaw

Active Member
Licensed User
Longtime User
Hi ,
I am having problems with my spinner declared in my form. As I can read when I use spinner from designer I dont have to initialize this object so this is my code

B4X:
Sub Globals
    Dim Toggla As Toggle
    '
    Dim spinloto,spinOpciones As Spinner
    '
    Dim Table1, Table2 As Table            
    Dim SiglaLoto,n1,n2,n3,st,param,monto As String 
End Sub

Sub Activity_Create(FirstTime As Boolean)
    '
    If FirstTime Then   
        btAdmin.Initialize("BlueTeeth")
        cmp20.Initialize("Printer")
    End If
    '
    spinOpciones.Add("MENU")
    spinloto.Add("LOTERIAS")
    PanelVenta.Initialize("")
    Activity.LoadLayout("FrmVenta")
    '   
    'BuildSpinnerOpciones
    'BuildSpinnerLoto
    '
End Sub

I am getting this error.....but I declare the spinner into designer

Transaccion=c809c8157e8e1c585e40a264ff464967
** Activity (main) Pause, UserClosed = false **
** Activity (ventacel) Create, isFirst = true **
ventacel_activity_create (B4A line: 46)
spinOpciones.Add("MENU")
java.lang.RuntimeException: Object should first be initialized (Spinner).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46)
at anywheresoftware.b4a.objects.SpinnerWrapper.Add(SpinnerWrapper.java:100)
at jq.lotonet.ventacel._activity_create(ventacel.java:289)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:552)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at jq.lotonet.ventacel.afterFirstLayout(ventacel.java:89)
at jq.lotonet.ventacel.access$100(ventacel.java:16)
at jq.lotonet.ventacel$WaitForLayout.run(ventacel.java:74)
at android.os.Handler.handleCallback(Handler.java:618)
at android.os.Handler.dispatchMessage(Handler.java:123)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4668)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:552)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:917)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Object should first be initialized (Spinner).
** Activity (ventacel) Resume **
** Activity (main) Resume **


Any cluees ?
 
Top