Android Question Two Activities

Carlos Pizzi

Member
Licensed User
Longtime User
Hello Forum!

I have 2 activities.

In Activity A I have a table (customers) from the full SQLite and 4 buttons (Add, Edit, Delete, Exit)

Activity.RemoveAllViews
Activity.LoadLayout ("A")
LlenarTabla (code where I fill the table from the SQLite)

Activity B (one customer record) is called by the Add, Modify, Delete Activity A.


For example, when I need to update a table data, call activity B and do the following:

Activity.RemoveAllViews
Activity.LoadLayout ("B")

Now when I want to accept or cancel to return to the table of Activity A and do the following:
Activity.RemoveAllViews
Activity.LoadLayout ("A")

But the table is empty I would have to call the LlenarTabla routine.

What I want to achieve is to call Activity B from A without losing the data in A and so when I return from the B do not have to fill the table again.

I hope you could explain me, thank you and await your responses.
 

KMatle

Expert
Licensed User
Longtime User
I would use 2 (or more) panels. So the data is in one activity and will be kept.

It's very easy to switch between them:

panelx.visible = true / false (to show a specific panel). You don't need to add/remove views then. By the way this is not a "bad way" to design apps.
 
Upvote 0

MaFu

Well-Known Member
Licensed User
Longtime User
As you describe you havn't two activities, it's only one and you switch between two layouts.
I would use two activities, each with its own layout.
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
Did you have a look at the SQLiteLight examples, link in my signature ?
The advantage with two activities is that the when you go back to Activity A the Table is automatically updated because it is filled again.
With two panels you will need to update the table on your own.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…