Newbie Question - Multiple Activities

DogHouse

New Member
Licensed User
Longtime User
First off... forgive my ignorance as I am fairly new in the Android development area.

I wanted to know what is the best practice (ie, easiest way) of creating and navigating between multiple views. For my application, I would like to develop multiple views (search, edit, home screen, etc). I believe the term in VB was forms. What is the best way to navigate between these views in Android? I don't want to have to enumerate all the views and make them invisible and have to individually bring the views elements I want to the foreground. Is it possible to bound individual view elements to a non-transparent label view and just bring that label view to the foreground when I need it?

So for example, in the DBUtils sample code... I would to create a "screen" that would list all the Student IDs, Student Name, and Birthdays in a listview. Then when the user clicks on the line of a particular student, the app would pull up and display the "View1" layout. In other words, I would like to have a listview that contains a directory of all the students and their basic data, let the user scroll and find the desire student, then "touch" that student, which would then pull up a layout screen that would have all the details pertinent to just that student. Of course, I would like to build the "details" screen in such a way where I can call it like a function or subroutine and pass the Student ID to it.

Any suggestions?

:sign0085:
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
There are several possible approaches. It is hard to say which one is the best.
You can use multiple activities, or a TabHost or switch between panels. You can load a different layout file to each panel using Panel.LoadLayout.

A tutorial about multiple activities is available here: Two activities example

Personally I prefer having multiple activities. It makes your code more clear and you also get the standard behavior of Android.
 
Upvote 0

DogHouse

New Member
Licensed User
Longtime User
Thanks

Many thanks, Erel and klaus. I was not aware of the panels, but I think I will go with the multiple Activity route. This will, as Erel pointed out, keep my code more compartmentalized and organized. Thanks again for the quick response.
 
Upvote 0
Top