• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

handle orientation changes programatically

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
If you live in a cold climate and on the grid, incandescent light can use less energy than LED. Tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic