Android Question TabStripViewer problem SOLVED

Ricky D

Well-Known Member
Licensed User
Longtime User
I have loaded the TabStrip into my Additional libraries and added it to the designer

I get this error when I try to run the code that loads a layout to the strip

B4X:
#AdditionalJar: com.android.support:support-v4
the IDE doesn't recogise it
I am running verion 7.3 of B4A

B4X:
#AdditionalJar: com.android.support:support-v4

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 ime As IME
    Private lblTitle As Label
    Private th As TabHost
    Private edtShiftID As EditText
    Private edtDate As EditText
    Private edtCarNo As EditText
    Private acetShiftType As AutoCompleteEditText
    Private edtStartTime As EditText
    Private edtFinishTime As EditText
    Private edtSpeedoFinish As EditText
    Private edtSpeedoStart As EditText
    Private edtSpeedoTotal As EditText
    Private edtLFinish As EditText
    Private edtLStart As EditText
    Private edtTotal1 As EditText
    Private edtOther As EditText
    Private edtTotal2 As EditText
    Private edtDriverIncome As EditText
    Private edtOwnerIncome As EditText
    Private edtFuelExp As EditText
    Private edtInsLevy As EditText
    Private edtNett As EditText
    Private edtDockets As EditText
    Private edtEFTPOS As EditText
    Private edtCash As EditText
    Private pnlDeleteAndCalculate As Panel
    Private edtHiringsFinish As EditText
    Private edtHiringsStart As EditText
    Private edtHiringsTotal As EditText
    Private tsShift As TabStrip
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("ShiftEdit1")
  
    lblTitle.Text = Main.ShiftAction
  
    'Setup the TabStrip
    tsShift.LoadLayout("thPage1","Page 1")

at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at b4a.example.shiftedit.afterFirstLayout(shiftedit.java:102)
at b4a.example.shiftedit.access$000(shiftedit.java:17)
at b4a.example.shiftedit$WaitForLayout.run(shiftedit.java:80)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5473)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:854)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
at dalvik.system.NativeStart.main(Native Method)
** Activity (shiftedit) Resume **
Error occurred on line: 57 (ShiftEdit)
java.lang.NullPointerException
at anywheresoftware.b4a.objects.TabStripViewPager.LoadLayout(TabStripViewPager.java:115)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:139)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:166)
at b4a.example.shiftedit.afterFirstLayout(shiftedit.java:108)
at b4a.example.shiftedit.access$000(shiftedit.java:17)
at b4a.example.shiftedit$WaitForLayout.run(shiftedit.java:80)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5473)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:854)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670)
at dalvik.system.NativeStart.main(Native Method)
 
Last edited:

Star-Dust

Expert
Licensed User
Longtime User
Please explain how you resolved. It will help who will have a similar problem.
Thank you
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
Please explain how you resolved. It will help who will have a similar problem.
Thank you
I fixed it by putting the additionaljar line in the main activity. I was putting it in the activity where I use the tabstripviewer. BTW I love this view it's awesome
 
Upvote 0
Top