rotation when doing job of httputils2

exjey

Member
Licensed User
Longtime User
When doing internet job with httputils2 and while waiting for the jobdone event to be fired, the user accidentally rotates the device and a java runtime error appears........ fortunately asking the user if he wants to continue, causing restart of the application.

While waiting asynchronously for the jobdone event to be fired, how to "freeze" temporarily the rotation of the device, even if the user turns it?

p/s possible reason for the runtime error is that rotation causes a restart of the activity object?
 

Tom Law

Active Member
Licensed User
Longtime User
'***********************
'Prevent tablet rotation
'***********************


Sub StopRotation



ToastMessageShow("Screen lock enforced", True)

Dim Phone As Phone


If 100%X > 100%Y Then
'landscape

Phone.SetScreenOrientation (0)

Else

Phone.SetScreenOrientation (1)

End If


DoEvents



End Sub
 
Upvote 0

exjey

Member
Licensed User
Longtime User
Erel i can see your point. B4A events made exactly for not having these kind of errors. The source is about 10 pages long, i am not sure which part i have to post here.

When the app stays calm and waiting for user interaction, rotating the device it just rearranges the display, no error in this case.

When i press a button and starts downloading (httputils -> .Download(...) and until the JobDone fires, the screen rotating produces this java error (i am not having any android device right now to recall it).

I know whats your meaning. Some event fires again... hm.., let me search it.
 
Upvote 0
Top