Android Question SetVisibleAnimated works only once?

JeffT

Member
Licensed User
In a routine that performs an undo, by opening a 'last known good' file from internal storage

I use

B4X:
Pane1.SetVisibleAnimated (500,false)

'do the file related work

Pane1.SetVisibleAnimated (500,True)

But the Pane does not become visible on the last line.

If I call the routine a second time, the Pane does re-appear.
What have I missed?
 

JeffT

Member
Licensed User
1. I hope that Pane1 type is B4XView.

It is

2. You forgot that SetVisibleAnimated is an async method:

Not forgot - not aware.
Im guessing that the effect is that the first call does what it likes, and the second call may be trying to do what it does , while the first is still operating.
Is there a way to make one wait for the other to complete, or to call it with a delayed start?
 
Upvote 0

JeffT

Member
Licensed User
B4X:
Pane1.SetVisibleAnimated (500,false)

'do the file related work
Sleep(500)
Pane1.SetVisibleAnimated (500,True)

Sadly, same result.
There is a small delay, the pane fades to black, but doesnt come back.

I'll think of some other way to show busy.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
B4X:
Pane1.SetVisibleAnimated (500,false)

'do the file related work
Sleep(500)
Pane1.SetVisibleAnimated (500,True)

Sadly, same result.
There is a small delay, the pane fades to black, but doesnt come back.

I'll think of some other way to show busy.
Try changing the Sleep(500) to sleep (1000) and see if it works.

My hunch is that the first animation has to complete before a new one will work, and setting the animation time to 500ms and the delay to 500ms is to close for comfort.
 
Upvote 0
Top