Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

handle orientation changes programatically

 
Jeet Dholakia
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeet Dholakia
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic