Stay in a second activity

Smee

Well-Known Member
Licensed User
Longtime User
When an activity calls a second activity and the device is turned the program reverts back to the calling activity.

I tried to stop this by putting the folowing code in;

B4X:
Sub Activity_Pause (UserClosed As Boolean)

If Userclosed=False Then
   Return
End If

This does not work. Can you advise the correct way to stop an inadvertant exit from an activity module

Thank you

Joe
 

Smee

Well-Known Member
Licensed User
Longtime User
It is a large project using a pretty big database. What i will do is write a smaller dummy project and post that

thanks


Joe
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Ok here it is. This uses Andrew's code for page flipping but it behaves exactly the same way.

Run the project in portrait mode,Press the first or top button then when the second activity appears, Rotate the device.

On my device the screen reverts to the calling or menu screen
 

Attachments

  • PtDemo.zip
    9.2 KB · Views: 170
Upvote 0

agraham

Expert
Licensed User
Longtime User
I don't see that behaviour on either my ZTE Blade or my Motorola Xoom. On rotate it remains on the second activity.

There are other problems with that demo code. The initialisation is only done once for the main activity which is wrong and there are two invocations of Activity.LoadLayout which looks odd.
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Hi Andrew, Thanks for the reply.

I don't see that behaviour on either my ZTE Blade or my Motorola Xoom. On rotate it remains on the second activity.

Ok i am looking at a new device so i will try it out in the next few days.

There are other problems with that demo code. The initialisation is only done once for the main activity which is wrong

Yes, Erel pointed that out to me yesterday. I have fixed it in the full program. I just copied and pasted that part b4 i realised i had left the if end block in

and there are two invocations of Activity.LoadLayout which looks odd

Is there something incorrect with that?
 
Upvote 0
Top