I think the Timer is causing this?

Bill Norris

Active Member
Licensed User
Longtime User
Activity1 is a "Welcome" screen. Touch anywhere on Activity 1 will start Acivity2. Activity2 consists of 8 "Menu" bitmaps, so user touches one the bitmaps which will start its corresponding Activity. I "finish" activity2 whenever leaving it, to release the memory consumed by the bitmaps. All of the other activities in the project (except Activity1) have a "back" button which returns user to Activity2. Activity2 has a "back" button which returns to Activity1. Pretty basic stuff here, everything works fine as intended, with one exception.

This code works fine to go from Activty2 to Activity1
Sub btn_back
activity.start(activity1)
end sub

If the user then again touches Activity1 to go back to Activity2, all is well. However, with this code in Activity2:

Sub btn_back
activity.start(activity1)
activity.finish
end sub

If the user then again touches Activity1, Activity1 goes away and I get the home screen of the tablet -- kind of like the whole app disappears. If I wait about 10 seconds after coming back to Activity1 and then touch, Activity2 loads as intended. This behavior does not occur when transitioning between Activity2 and any of the other Activities -- only Activity1. As mentioned before, I have activity.finish in the code that goes from Activity 2 to any other activity, and no problems -- only when going back to Activity1.
One more detail. On Activity1, there is a timer that is used to create a scrolling block of text, like credits at the end of a movie. I find that if I disable that timer, this issue I have described above does not occur -- I can go back and forth from 1 to 2 and back again with no delays, and everything works fine. As soon as I re-enable that timer on Activity1, the problem comes back. I am stumped!!!
 

Bill Norris

Active Member
Licensed User
Longtime User
RE:

CallSubDelayed didn't do the trick. What I am finding is it doesn't really appear to be the timer, but is the code in the timer. If I leave the timer enabled but remove any executable code, the problem goes away. If I have any code at all in the timer, the problem persists. Instead of going back to Activity2 when Activity1 is touched, Activity1 simply goes away and the "desktop" of the tablet is displayed. I created a test application with just 2 activities, 2 buttons to toggle between the two and a timer on activity1 that increments a number label. It worked fine. I am still stumped.
 
Upvote 0

Bill Norris

Active Member
Licensed User
Longtime User
Problem Solved!!!!!

I have finally discovered the cause (I think) of the problem described above. I originally had the timer increment set at 5, to achieve the desired scrolling speed of the labels in the scroll view. I changed increment to 50 and the problem went away. Guess if increment is set to small things can get goofy??
 
Upvote 0
Top