Android Question CallSubDelayed & java.lang.Exception

Pencil3

Member
Licensed User
A bit lost on this. Trying to pass a preference name between two activities. When I tried the below I receive the error that is below. Before the app force closes I see the result that I am trying to achieve.

B4X:
Sub ToolBar_NavigationItemClick
    CallSubDelayed(Main, "Activity_Create")
    Activity.Finish
End Sub


** Activity (prefs) Pause, UserClosed = true **
Killing previous instance (main).
** Activity (main) Create, isFirst = false **
Panel size is unknown. Layout may not be loaded correctly.
Panel size is unknown. Layout may not be loaded correctly.
** Activity (main) Resume **
PageCreated: 0
PageCreated: 1
An error occurred:
(Line: 0) End Sub
java.lang.Exception: Sub activity_create signature does not match expected signature.
public static anywheresoftware.b4a.pc.RemoteObject com.package.name.main_subs_0._activity_create(anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception


After doing some searching I tried to use a CallSubDelayed2, but still receive an error.

B4X:
Sub ToolBar_NavigationItemClick (Value As Object)
    CallSubDelayed2(Main, "Activity_Create", Value)
    Activity.Finish
End Sub

An error occurred:
(Line: 0) End Sub
java.lang.Exception: Sub toolbar_navigationitemclick signature does not match expected signature.
public static anywheresoftware.b4a.pc.RemoteObject com.package.name.prefs_subs_0._toolbar_navigationitemclick(anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Pencil3

Member
Licensed User
Thanks, I did see that. I have tried using StartActivity instead of CallSubDelayed, but it did not appear to work. When using StartActivity it appears that the activity resumes from being paused but without the updated preference name. If I restart the app it then displays the updated preference name in the Main activity.

Using CallSubDelayed results in the new preference name being displayed in the Main activity for a brief second before the app crashes.

 
Upvote 0
Top