Android Question Share Controls between Activities

renepatriana

Member
Licensed User
Regards.

I am a newbie in B4A and I have a question in which, I hope, you can help me.

In the Main Activity I have a sub (MySQL_Query) that connects to MySQL and obviously this is also the JobDone sub. In the JobDone sub, fill a ListView (ListViewProfile). It's okay.

In another activity I have another ListView (ListViewUser). How do I fill the ListViewUser from the Main Activity?

That is, how can I use controls for one Activity from another?

Thanks for the help you can give me.
 

DavideV

Active Member
Licensed User
Longtime User
Regards.

I am a newbie in B4A and I have a question in which, I hope, you can help me.

In the Main Activity I have a sub (MySQL_Query) that connects to MySQL and obviously this is also the JobDone sub. In the JobDone sub, fill a ListView (ListViewProfile). It's okay.

In another activity I have another ListView (ListViewUser). How do I fill the ListViewUser from the Main Activity?

That is, how can I use controls for one Activity from another?

Thanks for the help you can give me.

Hello, renepatriana,
you can declare, in the starter service for example, a global variable that match the type result of the Jobdone of the first activity. From that activity, in the Jobdone, save the result in that variable and fill the listview. The variable is now available in any other activity in your project and you can fill other listviews as well...

//Davide
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
Activities are for the UI only. Put all other stuff in a service (e.g. Starter) or several ones if you like. I use ine for communication tasks and another for database operations and a third for helper subs needed in all components.
 
Upvote 0
Top