Android Question Error while trying to close app


Well-Known Member
Licensed User
Please help iam trying to close the application by clicking the back button the phone. but error comes up. i have also tried to attach a copy of the code
here is the error
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Database size = 4096
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
Error occurred on line: 522 (B4XPagesManager)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug(
    at b4a.example.b4xpagesmanager$ResumableSub_HandleCloseRequest.resume(
    at b4a.example.b4xpagesmanager._handlecloserequest(
    at b4a.example.b4xpagesmanager._activity_keypress(
    at b4a.example.b4xpagesdelegator._activity_keypress(
    at b4a.example.main._activity_keypress(
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(
    at b4a.example.main$HandleKeyDelayed.runDirectly(
    at b4a.example.main$
    at android.os.Handler.handleCallback(
    at android.os.Handler.dispatchMessage(

Here is my code please help
#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&

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
    Private TabStrip1 As TabStrip
    Private Page3ListView1 As ListView
    Dim Parentprof As ListView
    Private Parentaccount As ListView
    Private Classteachers As ListView
    Private Newstudent As ListView
    Private Homeworklist As ListView
    Private Helpabout As ListView
    Private mustread As ListView
    Private combook As ListView
    Private Lessondata As ListView
    Private noticeboardshow As ListView
    Private B4XPageIndicator1 As B4XPageIndicator
'    Private Drawer As B4XDrawer
'    Private returnValue As Boolean
    Private Panel1 As Panel
End Sub

Public Sub Initialize
    Dim InitDB As ConnectToDB
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    B4XPages.SetTitle(Me, "B4XPages My start Page") 'Page title
    B4XPages.AddPage("Helpus", helpus) 'Add first page
    TabStrip1.LoadLayout("Page1", "Parent Profile " & Chr(0xF2BC)& " : ")
    'TabStrip1.LoadLayout("Page1", cs.Initialize.Typeface(Typeface.FONTAWESOME).Size(22).VerticalAlign(3dip).Append(Chr(0xF007)).PopAll.Append("Parent Profile").PopAll)
    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)& " : ")

    Page3ListView1.AddSingleLine($"Current Performance"$)
    'Page3ListView1.AddTwoLines("Item #" & 2, "This is the second line.")
    Page3ListView1.AddSingleLine($"Past Performance"$)
    Page3ListView1.AddSingleLine($"Performance Curves"$)
    Page3ListView1.AddSingleLine($"Compare Performance Record"$)
    Parentprof.AddSingleLine($"Parent Profile"$)
    Parentprof.AddSingleLine($"Change Number"$)
    combook.AddSingleLine($"Send Message To School"$)
    noticeboardshow.AddSingleLine($"Notice Board"$)
    Parentaccount.AddSingleLine($"Check Balance"$)
    Parentaccount.AddSingleLine($"Account Statement"$)
    Helpabout.AddSingleLine($"Help About App"$)
    mustread.AddSingleLine($"Must Read"$)
    Newstudent.AddSingleLine($"New Student Applications"$)
    Classteachers.AddSingleLine($"Get Class teacher Contacts"$)
    'ListView1.AddSingleLine($"Send Homework To Your Email Address"$)
    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"$)
End Sub

'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
Private Sub B4XPage_CloseRequest As ResumableSub
    Dim sf As Object = xui.Msgbox2Async("Close?", "Title", "Yes", "Cancel", "No", Null)
    Wait For (sf) Msgbox_Result (Result As Int)
    If Result = xui.DialogResponse_Positive Then
        Return True
    End If
    Return False
End Sub

Private Sub Button1_Click
    'xui.MsgboxAsync("Hello world!", "B4X")
End Sub

Private Sub TabStrip1_PageSelected (Position As Int)
    B4XPageIndicator1.CurrentPage = Position
End Sub

Private Sub ParentProf_ItemClick (Position As Int, Value As Object)
End Sub


  • Backup KABOJJAAPP 2021-03-24
    208.3 KB · Views: 54


Well-Known Member
Licensed User
You are missing some anchors. The layout doesn't fill the screen.

I wasn't able to reproduce this error. Does it still happen? Does it also happen in release mode? If so then post the error message.

surprisingly the error has stopped coming but now the challenge is when i click on

Private Sub ParentProf_ItemClick (Position As Int, Value As Object)
End Sub

it opens once when i click the back button and i open it i does not open . and it is not showing any error
Upvote 0