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. Amazon MP3 StoIntent start search

Okay, had this working and now a new Samsung Phone and something
changed with the Amazon Store. The old method doesn't work. The
package is there. Shazam is direct linking to the "Search". I can get
the App to Launch from my app, but not to feed it with a search

You'd think Amazon would document this. Anyone? Here is the stack of
what Shazam is doing.

I can launch the "IntentProxyActivity" but this just brings up the
Amazon MP3 app with a title bar and blank screen. It appears there is
some flag or action set to then tell the Amazon app to start it's
SearchActivity. If I try to start the SearchActivity intent directly,
I get a "permission denied".

Has anyone gotten a newer phone (Android 2.1) that has Amazon MP3
installed to launch into a search result page?

V/WindowManager( 2264): Dsptch 1 x166.0 y570.0 > Window{47b52780 paused=false}
I/ActivityManager( 2264): Starting activity: Intent
{ (has extras) }
D/PhoneWindow(11982): couldn't save which view has focus because the
focused view has no id.
D/dalvikvm(11982): threadid=39 wakeup: interrupted
I/ActivityManager( 2264): Start proc for activity pid=12022
uid=10029 gids={3003, 1015}
W/InputManagerService( 2264): Window already focused, ignoring focus
gain of:$Stub
I/Zygote  (12022): Zygote: pid 12022 has INTERNET permission, then set
capability for CAP_NET_RAW(13)
I/dalvikvm(12022): De{*filter*} thread not active, ignoring DDM send
(t=0x41504e4d l=38)
I/dalvikvm(12022): De{*filter*} thread not active, ignoring DDM send
(t=0x41504e4d l=32)
I/ActivityThread(12022): Publishing provider
V/WifiProgressStore(12022): WifiProgressStore Created
D/Configuration(12022): active site = local
I/System.out(12022): interface name: null
D/dalvikvm(12022): GC freed 3204 objects / 285096 bytes in 184ms
I/ActivityManager( 2264): Starting activity: Intent
{ act=android.intent.action.SEARCH flg=0x14000000 (has extras) }
D/dalvikvm(12022): GC freed 4196 objects / 312240 bytes in 39ms


2. Droid Motorola

I have an app, in which part of its job is to mute and unmute the
microphone, for some reason this is working fine in all mobiles except for
Motorola Droid, can some one help me?


3. Java 1.6.0 update 21

4. Possible to over-ride default Android libraries?

5. Media Player restarts during call

6. Help with user notification/dialog

7. ACTION_HEADSET_PLUG without everlasting service possible?