Android Question Orientation Change in Activity

treehousefrog

Member
Licensed User
Longtime User
Hey guys,

Does anyone know a way to detect orientation change in a service? I'm using it with Standout library and have grabbed the screen height and width in the main activity before the service launches, but I just don't know how to tell it which one to use!

Thanks very much in advance :-D

Adam
 

eps

Expert
Licensed User
Longtime User
I would use a comparison between the two... i.e. if the height is larger than the width, then it's portrait. Otherwise landscape. Then set accordingly
 
Upvote 0

treehousefrog

Member
Licensed User
Longtime User
Thanks for the suggestion, but I'm not sure how to get the height and width from the service either. I can do it in main using activity.height or 100%y, but then if they rotate the service I don't know how to detect that... ideas?
 
Upvote 0

eps

Expert
Licensed User
Longtime User
Ah...

I don't really know, haven't worked too much with Services.

But did find this "Before delving into the details I would like to say that using services is simpler than it may first sound. In fact for many tasks it is easier to work with a service instead of an activity as a service is not paused and resumed all the time and services are not recreated when the user rotates the screen. There is nothing special with code written in service.
Code in a service module runs in the same process and the same thread as all other code."

From here : http://www.b4x.com/android/forum/threads/service-modules.7542/
 
Upvote 0
Top