How to set device wide screen orientation

by Michel » Thu, 30 Jul 2009 01:21:04 GMT

Sponsored Links
 Hi androids,

This is my first message over here and I'm a starting android
developer so please be patient. Here's my case; I'm trying to create a
simple program that sets the device's screen orientation by the press
of a button. It's quite easy to set and change the orientation for the
current activity, but I want to set and keep the setting until the
button is pressed again like when the keyboard is slide out and back
in on a G1 or by the movementsensor.

I started with using the setRequestedOrientation() but I quickly found
that's only for the current activity, as soon is I close the activity
the screen returns to it's original state. I then found that it's
possible to set orientation with updateConfiguration()

Configuration config = new Configuration();
config.orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
getResources().updateConfiguration(config, getResources

but this doesn't seem to have any effect for what soever.

I've spent hours and hours googling for possible solutions but I'm
completely stuck and the only option I found was to emulate the
keyboard slide out and in, but besides the fact that I wouldn't know
how, that seems a bit of a big solution for what seems to be a simple
I thought this would be easy (and maybe it is), can somebody help me
out or point me in the right direction?

Thanks in advance,


Other Threads

1. Android phones hope to take a bite out of Apple dominance

A new breed of Androids are about to touch down in Australia as
handset makers put the iPhone's {*filter*} to the test with new
smartphones built on Google's mobile operating system.

While HTC is the only company to have released Android handsets here
in Australia, Samsung will unveil its first Android offering next week
with the launch of the Icon Galaxy.

The Galaxy taps into the desire to customise and personalise phones
and integrate them with applications used elsewhere said Tyler McGee,
telecommunications vice president at Samsung Australia.

eople are now buying their fifth, sixth or seventh handset, so I'd
say globally the smartphone category is moving fast into the
mainstream,he said.

The Galaxy boasts an organic LED screen and 5 mega-pixel camera, and
8GB of internal memory (which is upgradeable to 24GB) also helps to
boost its smartphone credentials.

The launch of the Galaxy will be followed closely by HTC's Hero, which
is due here some time before October. No stranger to the Android
platform, HTC launched the G1 Dream here last February and its HTC
Magic followed a few months later.

e've certainly taken leadership with Android. We believe that in the
next 18 months to two years that the cloud (where you store all your
contacts and photos etc) will have a determinate factor on what
devices you choose,said Anthony Petts, HTC's regional sales and
marketing director.

He said the Hero would offer better functionality and an improved user
experience with a new capbability called cenesthat allows users to
group weekday or weekend usage profiles using widgets that are live
and intuitive.

e are continuing to expand the Android portfolio of products and
strongly believe end users are looking for different sizes, form
factors, and keyboards, so we're giving them a variety of choices,he

While no other handset makers have formally announced new Android
models for the Australian market, Motorola is reported to have two
phones close to completion and set for release to some markets in
September, although the company declined to provide specific timings.

'Motorola can confirm that we will be launching Android handsets but
can't disclose any details at this time,it said.

Like the iPhone, one of Android's key selling features is the mass of
third-party applications being created for the platform. The Android
market now has 8000 applications for download and the fact that these
can be built on open source technology has made it a popular platform
among developers.

According to Petts, Android applications deliver a unique level of
depth, integrating tightly with functions such as cameras and maps,
exemplified by the popular Sky Maps application which can locate a
position using the GPS to map out constellations visible from a
particular location.

But interesting applications may not be enough to win over the
mainsteam smartphone market said Robin Simpson, a research director at

uccess in the smartphone market is all about usablity and cool
design. Google doesn't control the hardware so if phone makers don't
come up with the good designs, that will make the platform less

 http://www.***.com/ {*filter*}-20090828-f1qo.html

2. <Android-Beginners> Query : How to get the full path of the files under "res" folder of an Android App?

I may be wrong but I don't think you need the full path of where they are on
the device...  You should be able to reference them using the R class.


3. can I use EditText in AppWidget?

4. How to submit to ADC 2

5. Customize search bar UI

6. OpenGL - Threading Texture Loading

7. Unable to Set SeekBar Minimum Width Programmatically