i want to show details for a selected item in a new activity and i simply dont like the way "using public variables and predefined activity"
i prefer to use a class and make activity by calling class.initialize(item_info as some type)
i tried to make an activity in class; after definition of activity "dim a as activity" i got a problem on this line a.initialize("event") error says i should initialize item(activity) before using it( I should initialize that before initializing that )
then i tried to extend class as activity by #Extends: SDKActivities.Activity
b4a says :
error: package SDKActivities does not exist
public class mcn extends SDKActivities.Activity implements BA.SubDelegator{
and for last try i found on forum this topic
adding this line to manifesto :
AddApplicationText(<activity android:name="my.library.package.name.myclassname"/>)
and i got
java.lang.RuntimeException: Object should first be initialized (Activity).
Did you forget to call Activity.LoadLayout?
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.ViewWrapper.innerInitialize(ViewWrapper.java:73)
at anywheresoftware.b4a.objects.ViewWrapper.Initialize(ViewWrapper.java:67)
at b4a.jf.mcn._initialize(mcn.java:49)
at b4a.jf.main._activity_create(main.java:403)
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:348)
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.jf.main.afterFirstLayout(main.java:104)
at b4a.jf.main.access$000(main.java:17)
at b4a.jf.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6694)
i prefer to use a class and make activity by calling class.initialize(item_info as some type)
i tried to make an activity in class; after definition of activity "dim a as activity" i got a problem on this line a.initialize("event") error says i should initialize item(activity) before using it( I should initialize that before initializing that )
then i tried to extend class as activity by #Extends: SDKActivities.Activity
b4a says :
error: package SDKActivities does not exist
public class mcn extends SDKActivities.Activity implements BA.SubDelegator{
and for last try i found on forum this topic
how to create activity in libraries to use in the app
I created a small library to manage related activity in some form. I would like to make small functional modules in libraries for use in various app. I call these forms in an app (with startActivity) but the system generates this error: Mistake or something you can not do this?
www.b4x.com
adding this line to manifesto :
AddApplicationText(<activity android:name="my.library.package.name.myclassname"/>)
and i got
java.lang.RuntimeException: Object should first be initialized (Activity).
Did you forget to call Activity.LoadLayout?
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:50)
at anywheresoftware.b4a.objects.ViewWrapper.innerInitialize(ViewWrapper.java:73)
at anywheresoftware.b4a.objects.ViewWrapper.Initialize(ViewWrapper.java:67)
at b4a.jf.mcn._initialize(mcn.java:49)
at b4a.jf.main._activity_create(main.java:403)
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:348)
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.jf.main.afterFirstLayout(main.java:104)
at b4a.jf.main.access$000(main.java:17)
at b4a.jf.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6694)
B4X:
myclass init.
Public Sub Initialize(str As String) As Activity
Dim a As Activity
a.Initialize("av")
Return a
End Sub
and in my main activty i'v
Dim v As myclass
StartActivity(v.Initialize("c"))