Android Question error comes when i start application

Makumbi

Well-Known Member
Licensed User
Please help when i run the application i get the error below

B4X:
 ' Error comes when i reach here

    TabStrip1.LoadLayout("Pages1", "Parent Profile " & Chr(0xF2BC)& " : ")

B4X:
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Database size = 4096
Error occurred on line: 62 (B4XMainPage)
java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:170)
    at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
    at anywheresoftware.b4a.objects.TabStripViewPager.LoadLayout(TabStripViewPager.java:116)
    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.debug.Debug.delegate(Debug.java:262)
    at b4a.example.b4xmainpage._b4xpage_created(b4xmainpage.java:149)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.debug.Debug.CallSub4(Debug.java:318)
    at anywheresoftware.b4a.debug.Debug.CallSubNew2(Debug.java:285)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug2(Common.java:1055)
    at b4a.example.b4xpagesmanager._createpageifneeded(b4xpagesmanager.java:1063)
    at b4a.example.b4xpagesmanager._showpage(b4xpagesmanager.java:420)
    at b4a.example.b4xpagesmanager._addpage(b4xpagesmanager.java:248)


B4X:
Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region

'Ctrl + click To export As zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip

Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Public SQL As SQL
    Public B4XLoading As B4XLoadingIndicator
'    Private B4XPageIndicator1 As B4XPageIndicator
    Public PanBacking As B4XView
    Dim helpus As Helpme
    Dim cnumber As Changenumber
    Dim academ As academics
    Dim regs As Registratedstatus
    Private TabStrip1 As TabStrip
    Private Page3ListView1 As CustomListView
    Dim Parentprof As CustomListView
    Private Parentaccount As CustomListView
    Private Classteachers As CustomListView
    Private Newstudent As CustomListView
    Private Homeworklist As ListView
    Private Helpabout As CustomListView
    Private mustread As CustomListView
    Private combook As CustomListView
    Private Lessondata As ListView
    Private noticeboardshow As CustomListView
    Private B4XPageIndicator1 As B4XPageIndicator
'    Private Drawer As B4XDrawer
'    Private returnValue As Boolean
    Private Panel1 As Panel
    'Dim lblk As Label
    Private Label1 As B4XView
End Sub

Public Sub Initialize
    Dim InitDB As ConnectToDB
    InitDB.Initialize
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
    B4XPages.SetTitle(Me, "B4XPages My start Page") 'Page title
  
    helpus.Initialize
    B4XPages.AddPage("Helpus", helpus) 'Add first page
    regs.Initialize
    B4XPages.AddPage("Registrationstatus", regs) 'Add first page
  
    cnumber.Initialize
    B4XPages.AddPage("Changenumber", cnumber) 'Add first page
  
    academ.Initialize
    B4XPages.AddPage("Academics", academ) 'Add first page
  

  
    TabStrip1.LoadLayout("Page2", "Accounts " & Chr(0xF19C)& " : ")
    TabStrip1.LoadLayout("Page3", "Academics " & Chr(0xF19D)& " : ")
    TabStrip1.LoadLayout("Page4", "Communication Book " & ": " & Chr(0xF1D7)& " : ")
    TabStrip1.LoadLayout("noticeboardlist", "Notice Board " & Chr(0xF2BC)&  ": ")
    TabStrip1.LoadLayout("Page5", "New Admissions "& Chr(0xF0C0)& ": ")
    TabStrip1.LoadLayout("Page6", "Home work " & Chr(0xF019)& " : ")
    TabStrip1.LoadLayout("Lesson", "Digital Lesson " & Chr(0xF019)& " : ")
    TabStrip1.LoadLayout("Page7", "Get Class Teacher Details " & Chr(0xF007)& " : ")
    TabStrip1.LoadLayout("Page8", "Must Read " & Chr(0xF071)& " : ")
    TabStrip1.LoadLayout("Page9", "Help About App "& Chr(0xF095)& " : ")

          
    Homeworklist.AddSingleLine($"Download Homework"$)
    Homeworklist.AddSingleLine($"Send work To Your Email"$)
    Homeworklist.AddSingleLine($"Send Multiple Classes To Your Email"$)
    Lessondata.AddSingleLine($"Digital Lessons"$)
    Lessondata.AddSingleLine($"Send Lesson Notes to Email"$)
  
    'The problem is here
    B4XPages.AddMenuItem(Me,"Parent Profile")   'tag is by default set to the Title: mnu1
    B4XPages.AddMenuItem(Me,"Accounts")
    B4XPages.AddMenuItem(Me,"Academics")   'tag is by default set to the Title: mnu1
    B4XPages.AddMenuItem(Me,"Communication Book")
    B4XPages.AddMenuItem(Me,"Notice Board")   'tag is by default set to the Title: mnu1
    B4XPages.AddMenuItem(Me,"New Admissions")
    B4XPages.AddMenuItem(Me,"Home work Download")   'tag is by default set to the Title: mnu1
    B4XPages.AddMenuItem(Me,"Get Class Teacher Details")
    B4XPages.AddMenuItem(Me,"Must Read")
    B4XPages.AddMenuItem(Me,"Help")

    Parentprof.Add(CreatePanel("Parent Profile"), "Parent Profile")
    Parentprof.Add(CreatePanel("Change Number"), "Change Number")
  
    Page3ListView1.Add(CreatePanel2($"Current Performance"$), $"Current Performance"$)
    Page3ListView1.Add(CreatePanel2($"Past Performance"$), $"Past Performance"$)
    Page3ListView1.Add(CreatePanel2($"Performance Curves"$), $"Performance Curves"$)
    Page3ListView1.Add(CreatePanel2($"Compare Performance Record"$), $"Compare Performance Record"$)
    combook.Add(CreatePanel3($"Send Message To School"$), $"Send Message To School"$)
    Parentaccount.Add(CreatePanel4($"Check Balance"$), $"Check Balance"$)
    Parentaccount.Add(CreatePanel4($"Account Statement"$), $"Account Statement"$)
    Newstudent.Add(CreatePanel5($"New Student Applications"$), $"New Student Applications"$)
    mustread.Add(CreatePanel6($"Must Read"$), $"Must Read"$)
    Classteachers.Add(CreatePanel7($"Get Class teacher Contacts"$), $"Get Class teacher Contacts"$)
    Helpabout.Add(CreatePanel8($"Help About App"$), $"Help About App"$)
    noticeboardshow.Add(CreatePanel9($"Notice Board"$), $"Notice Board"$)
  
    For Each lbl As Label In GetAllTabLabels(TabStrip1)
        lbl.Typeface=Typeface.SANS_SERIF
        lbl.Typeface = Typeface.FONTAWESOME
                  
    Next

End Sub


Sub CreatePanel (t As String) As Panel
    Dim p As Panel=xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,Parentprof.AsView.Width, 60dip)
    p.LoadLayout("item")
    Label1.text=t
    Label1.Width=Parentprof.AsView.Width
    Return p
    
End Sub


Sub CreatePanel2 (t As String) As Panel
    Dim p As Panel=xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,Page3ListView1.AsView.Width, 60dip)
    p.LoadLayout("item2")
    Label1.text=t
    Label1.Width=Page3ListView1.AsView.Width
    Return p
    
End Sub

Sub CreatePanel3 (t As String) As Panel
    Dim p As Panel=xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,combook.AsView.Width, 60dip)
    p.LoadLayout("item3")
    Label1.text=t
    Label1.Width=combook.AsView.Width
    Return p
    
End Sub

Sub CreatePanel4 (t As String) As Panel
    Dim p As Panel=xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,Parentaccount.AsView.Width, 60dip)
    p.LoadLayout("item4")
    Label1.text=t
    Label1.Width=Parentaccount.AsView.Width
    Return p
    
End Sub

Sub CreatePanel5 (t As String) As Panel
    Dim p As Panel=xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,Newstudent.AsView.Width, 60dip)
    p.LoadLayout("item5")
    Label1.text=t
    Label1.Width=Newstudent.AsView.Width
    Return p
    
End Sub
Sub CreatePanel6 (t As String) As Panel
    Dim p As Panel=xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,mustread.AsView.Width, 60dip)
    p.LoadLayout("item6")
    Label1.text=t
    Label1.Width=mustread.AsView.Width
    Return p
    
End Sub
Sub CreatePanel7 (t As String) As Panel
    Dim p As Panel=xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,Classteachers.AsView.Width, 60dip)
    p.LoadLayout("item7")
    Label1.text=t
    Label1.Width=Classteachers.AsView.Width
    Return p
    
End Sub

Sub CreatePanel8 (t As String) As Panel
    Dim p As Panel=xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,Helpabout.AsView.Width, 60dip)
    p.LoadLayout("item8")
    Label1.text=t
    Label1.Width=Helpabout.AsView.Width
    Return p
    
End Sub
Sub CreatePanel9 (t As String) As Panel
    Dim p As Panel=xui.CreatePanel("")
    p.SetLayoutAnimated(0,0,0,noticeboardshow.AsView.Width, 60dip)
    p.LoadLayout("item9")
    Label1.text=t
    Label1.Width=noticeboardshow.AsView.Width
    Return p
    
End Sub
 
Top