Activity.finish Question..

abner69

Member
Licensed User
Longtime User
:sign0163: is there a way to tell which activities are still active?

Mi app fails to close/end properly.

I have read the files on activity life, but fail to understand if after an activity.finish, is the activity really dead?

here is the program flow of how the app is starts:


act1 - start services, start act 2, activity.finish
act 2 - load Globals, talk with service, start Menu, activity.finish

from Menu Activity, user may start 4 other activities..

one of these activities is a file reader, called reader_b.

the One thing common in each of these 4 activities are: under activity_pause, I have:
StartActivity("menu")
activity.finish


and in Menu, under activity pause, I have:

activity.finish
exitapplication


each time I go to exit the application, I am getting same error:
Error occured in sub:reader_b_globals....object should first be initialized (map)

BUT, I have already EXITED this reader_b activity with the activity.finish command!

I have tried removing exitapplication, using only exitapplication, but I am unable to to figure out why it works not.

Any help would be greatly appreciated!

...Pablo
 

mc73

Well-Known Member
Licensed User
Longtime User
If you remove the 'exitApplication" command, does the app try to return to reader_b activity? What does logging say?
 
Upvote 0

abner69

Member
Licensed User
Longtime User
@mc73,

thanks for the reply. during the preparaton of mi logs to show you, i noticed that userclosed was not triggered as true, so, the reader_b was not getting the activity.finish.

that is working now.

however, when i attempted to enter reader_b (after verifying that did receive the activity.finish), it is not recieving the firsttime flag.... i would think that if the activity is finished (closed), and re-opened, it should have firsttime flag true again.

...Pablo
 
Upvote 0

abner69

Member
Licensed User
Longtime User
Fixed

After some experimentation, i find out that just because you issue an activity.finish command when switching between activities, does not mean that the activity is actually gone.

subsequent entries into the activity will show the firsttime flag set to false.

my workaround was simply to create a global var called isReload, set it to true before calling the activity, and then checking to see if firsttime=true or isReload=true, and executing the firsttime code (and setting reload to false).

I am definately a :sign0104:, and hope this helps out someone else with the same problem.

Again, a special thanks to @mc73 for the help!
 
Upvote 0
Top