Android Question serchview inside TabStripViewPager

Stefano Bordini

Member
Licensed User
Longtime User
Hi guys,in my project i have 2 activity,and in the second activity i put a tabstrip whit 2 layaout,in the first layout i have a panel whit serchview but serchviev dont't work inside tabstrip but work correctly outside tabstrip,i use this code

B4X:
Activity.LoadLayout("controlloprezzi")
    sv.Initialize(Me,"sv")
    cities.Initialize
    If File.Exists(File.DirInternal,"controlloPrezzi.db") = False Then
        File.Copy(File.DirAssets,"controlloPrezzi.db",File.DirInternal,"controlloPrezzi.db")
    End If
   
    If FirstTime Then
         cities = File.ReadList(File.DirAssets, "Cities.txt")
        'As an optimization we store the index as a process global variable
        'and only build it once.
       
        index = sv.SetItems(cities)
        Log(cities.Size)
    Else
        sv.SetIndex(index)
        Log(cities.Size)
    End If
    ime.Initialize("ime")
    ime.AddHeightChangedEvent
    TabStrip1.LoadLayout("consacquisti","Consulta Prezzi")
    TabStrip1.LoadLayout("insacquisto","Inserisci Acquisto")
if i initialize serchview don't work if not initialize outside tabstrip work inside have this error
Logger connesso a: HUAWEI VOG-L29
--------- beginning of crash
--------- beginning of main
--------- beginning of system
Copying updated assets files (3)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (controlloprezzi) Create, isFirst = true **
false
Error occurred on line: 48 (controlloprezzi)
java.lang.RuntimeException: Class instance was not initialized (searchview)
at anywheresoftware.b4a.debug.Debug.shouldDelegate(Debug.java:242)
at b4a.example.searchview._setitems(searchview.java:57)
at b4a.example.controlloprezzi._activity_create(controlloprezzi.java:383)
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 b4a.example.controlloprezzi.afterFirstLayout(controlloprezzi.java:104)
at b4a.example.controlloprezzi.access$000(controlloprezzi.java:17)
at b4a.example.controlloprezzi$WaitForLayout.run(controlloprezzi.java:82)
at android.os.Handler.handleCallback(Handler.java:888)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8147)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
** Activity (controlloprezzi) Resume **
 
Last edited:

Stefano Bordini

Member
Licensed User
Longtime User
Ok in this example sv.initialize is commented and when run program make an error
 

Attachments

  • testserchv.zip
    9.5 KB · Views: 173
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…