Android Question How to close activities properly ?

Yayou49

Active Member
Licensed User
Hi,

First of all, sorry for the size of this message, but I want to explain as better as possible my problem.

I have a problem with the close activities.

Starting point is 3 activities as following:


(to understand better my sample, considere that activity1 is the list of cars to repare, Activity2 is the list of what to do on the car, and activity3 is what you have really done on the car)

Loading the first activity with:
B4X:
Sub Activity_Create(FirstTime As Boolean)

    Activity.LoadLayout("Activity1")
    InitCtrl '(load a listview with an SQL link)

End Sub

Clicking on the first item of the listview of activity 1, calls activity 2 with:
B4X:
StartActivity(Activity2)

Clicking on the right Arrow of activity 2, calls activity 3 with:
B4X:
StartActivity(Activity3)

Now I want to click on the cross of activity3 and go back to activity1.

I've added in the in activity3_resume:

B4X:
Activity.Finish
StartActivity(Activity1)

After the click on cross, Activity3 is shown.

First problem: Doing that, my listview is not updated the second time
Second problem: if I click on the second item of the listview of activity 1, data in activity2 are not updated

It seems with my method that after the 3 first screens, system will not go through the sub Activity_Create and keep old data.

Your help is really needed to understand how to solve my problem.

Thx in advance.
 
Last edited:

Yayou49

Active Member
Licensed User
no, I explain.
Suppose the list is a list of cars to repare.
I select the first one and in the third screen I save the information that this car has been repared.
When I go back to the list I have 1 car less to repare.
Clear enough ?

(to understand better my sample, considere that activity1 is the list of cars to repare, Activity2 is the list of what to do on the car, and activity3 is what you have really done on the car)
 
Last edited:
Upvote 0

Yayou49

Active Member
Licensed User
Thanks Erel,

I found a third solution working fine .
Could you please tell me if this solution is a good solution or not a so good ?....

To solve my problem, I've added in each Activity_Pause of my 3 activities an Activity.Finish
and for activity2, after this Activity.Finish added a StartActivity(Activity1)
and for activity3, after this Activity.Finish added a StartActivity(Activity2)

With this solution, I'm sure to have all information up to date.

What do you think ?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…