Stack panels (or activities)

claudio

Member
Licensed User
Longtime User
I'm new in B4A programming. :sign0085:

I'm trying to develop a DB application and i need to stack panels for example i need to have a list of records and from that list i have to edit a record and from the edit I need to lookup a related table and so on. (similar to SQLExample but more flexible and builded at runtime)

Which is the better way to do this?
I have to implement a Panel Stack controlled by Activity_KeyPress sub?
But what are the implications (memory handle, screen rotation and so on)?

Or I have to use a limited deep of stacked activities, and in that case which are the memory problems?

Some sample to stack panels?
I seen ThreeActivityExample and SlidingPanels samples that are similar.

Many thanks
 

claudio

Member
Licensed User
Longtime User
It is better to use multiple activities. This way Android will handle the stack for you. For example the back key will work as it should.

Check CallSubDelayed keyword. It significantly simplifies the interaction between activities.

Yes, useful in the condition explaned in the demo, thanks for the tip, but I have still some doubts about activities.
Can I do something like this?

B4X:
Sub Button1_Click
   Dim a(10) As Activity
   a(0) = Activity2
   CallSubDelayed2(a(0), "ShowList", "This is the title")
End Sub

If I can't reference the activities, it's hard to build stacks because I can't virtualize calls. If I understand well I can't call an activity more then once, it's not just an instance of a object, so I really need references.

thanks
 
Upvote 0

claudio

Member
Licensed User
Longtime User
I guess I don't understand what you want. Why could you not use the code below:

B4X:
Sub Button1_Click
   StartActivity(Activity2)
End Sub
Sub Button2_Click
   StartActivity(Activity3)
End Sub

:sign0142: Yeah! this work.

B4X:
Sub Button1_Click
    'Dim a(10) As Activity this is wrong
    Dim a(10) As Object
    a(0) = Activity2
    CallSubDelayed2(a(0), "ShowList", "This is the title")
End Sub

I need to reference activities as a number so I can write subs which can act on every activity.

If I write something useful I will post it here.

Claudio
 
Upvote 0
Top