Android Question Error while trying to close app

Makumbi

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
B4X:
*** 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)
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.keywords.Common.CallSubDebug(Common.java:1050)
    at b4a.example.b4xpagesmanager$ResumableSub_HandleCloseRequest.resume(b4xpagesmanager.java:842)
    at b4a.example.b4xpagesmanager._handlecloserequest(b4xpagesmanager.java:809)
    at b4a.example.b4xpagesmanager._activity_keypress(b4xpagesmanager.java:564)
    at b4a.example.b4xpagesdelegator._activity_keypress(b4xpagesdelegator.java:64)
    at b4a.example.main._activity_keypress(main.java:433)
    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.main$HandleKeyDelayed.runDirectly(main.java:231)
    at b4a.example.main$HandleKeyDelayed.run(main.java:228)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)

Here is my code please help
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
    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
    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
    
    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")
    B4XPages.ShowPage("Helpus")
End Sub

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

Private Sub ParentProf_ItemClick (Position As Int, Value As Object)
    B4XPages.ShowPage("Helpus")
End Sub
 

Attachments

  • Backup KABOJJAAPP 2021-03-24 11.55.zip
    208.3 KB · Views: 39

Makumbi

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

B4X:
Private Sub ParentProf_ItemClick (Position As Int, Value As Object)
    B4XPages.ShowPage("Helpus")
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
Top