Is it possible to load an activity inside another activity?

Ati

Member
Licensed User
Longtime User
Hi,

here's my scenario: I have an activity with a dynamically generated menu (loaded from a webpage, based on what the viewer has access to).

When the phone is in portrait mode, nothing else fits besides the menu, so I have the menu, and clicking the buttons loads a new layout and starts a new activity for the given menu item. Pressing the back button goes back to the menu.

So far so good.

Here's what I would like: when the phone is in landscape mode, the menu items are on the left, and there is a lot of space besides the menu on the right. I was thinking of loading the new activity here. For example on a new panel. This would mean there are two activities visible and running at the same time: the menu itself, and the menu item. Is this possible?

I could achieve this by putting all the code in one activity, and just use different layouts, but that would make this one activity HUGE, and I would rather work with smaller activities if possible.

Thanks,

Ati
 

NJDude

Expert
Licensed User
Longtime User
What you need to do is to create a different layout for landscape, so, you should have 2, one for portrait and one for landscape, you can achieve that by using the designer scripts, that will not make it huge as you said.

There's no such thing as 2 activities running at the same time side by side.
 
Upvote 0

Ati

Member
Licensed User
Longtime User
The activity won't get huge because of the layout variations, it will get huge because one activity will hold all the actions for the 20-30 menu items, which all do different things.

This is what I wanted to avoid.

Thanks for the very quick response. I'll put all code in one activity then.
 
Upvote 0

shawny

Member
Licensed User
Longtime User
Sorry to reply to something so old, but I wanted to say this is actually possible. It's something I do in a lot of my applications. I've always been the OO developer. So keeping things separate is important. It's something programmers are taught to do. Divide portions of your code into different Activities, have different layouts assigned to the various activities. 1 Activity might handle user login via a remote api call, apon successful login launch a different activity to list contacts in a crm.

As I still agree with NJDude, you should put it all in different layouts for the same activity's views.

As for Ati, here's the code you were looking for:

Sub loggedin
StartActivity(CRMcontacts)
End Sub

That will pause the current activity and launch the 2nd activity as desired.
 
Upvote 0
Top