File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes handle orientation changes programatically Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "handle orientation changes programatically" Watch "handle orientation changes programatically" New topic
Author

handle orientation changes programatically

Jeet Dholakia
Greenhorn

Joined: Dec 15, 2012
Posts: 25
Hello,

I have an app in which I have to handle orientation change myself rather than the system handling it,

here's the psuedocode

if(orientation==landscape)

rotate view by 90 degrees

else

keep the original view

can someone explain me how to handle it? I have checked many solutions over the net but i cant find one that fits this requirement...

Thanks
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4168
    
  21

Why do you need to handle the rotation yourself, and are you sure you need to? As you said, you checked other solutions and they don't fit your requirements. So perhaps you need to tell us your requirements, what you have tried, and why they didn't work so we don't re-hash the same old discussions. Make sure you have read the Android Developer Network article on this (http://developer.android.com/guide/topics/resources/runtime-changes.html) to see what it suggests - it has two examples on how it should be done.


Steve
Jeet Dholakia
Greenhorn

Joined: Dec 15, 2012
Posts: 25
Steve Luke wrote:Why do you need to handle the rotation yourself, and are you sure you need to? As you said, you checked other solutions and they don't fit your requirements. So perhaps you need to tell us your requirements, what you have tried, and why they didn't work so we don't re-hash the same old discussions. Make sure you have read the Android Developer Network article on this (http://developer.android.com/guide/topics/resources/runtime-changes.html) to see what it suggests - it has two examples on how it should be done.


Hey Steve,

thanks ,I tried that link which you gave and I tried the second example but thats not the requirement.

Basically I have a camera application where, on rotating the phone from portrait to landscape, I just want to rotate one particular menu and not the whole parent view(and activity itself)

I checked for handling runtime orientation changes on google, and almost all of them point to the example which you gave. I also tried this code out...





AS shown, the above code works in rotating my menu by 90 degrees when the phone is in landscape while keeping other layouts in same mode, but the obvious problem is when I turn it back to portrait mode , its still tilted and I am confused in finding a way to rotate it back to its original position.

Cant I poll the value of the angle(90,180,etc) of the phone and rotate my menu?

Thanks,
Jeet
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: handle orientation changes programatically
 
Similar Threads
Localization Of Desktop Icons For An Application
when i change android:orientation to horizontal it shows blank screen
Application crashes
Screen Orientation
How get screenOrientation in activity?