[android-developers] Re: Is it possible to rotate screen by program code but not accelerometer sensor?

2010-09-19 Thread HaMMeReD
You can set the orientation of the app in your manifest using
android:screenOrientation on your activity element.

That will hard-code it to rotate to landscape or portrait by default,
then just use SENSOR_DELAY_UI when creating the handler as I think
that's the slowest and uses the least battery.

Maybe you can switch between landscape and portrait by modifying the
activity since it's exposed in the xml it is probably exposed in the
api too.

Adam

On Sep 18, 10:59 pm, San Zhang dahua007...@gmail.com wrote:
 I known it can be disabled by Settings. My meaning is if there are APIs to
 manage rotate screen on system level but not my app only.

 2010/9/19 Dianne Hackborn hack...@android.com

  On Fri, Sep 17, 2010 at 5:17 PM, San Zhang dahua007...@gmail.com wrote:

  2. Accelerometer consumed power greatly.

  The power needed for the accelerometer is trivial next to the power needed
  for the screen.

  --
  Dianne Hackborn
  Android framework engineer
  hack...@android.com

  Note: please don't send private questions to me, as I don't have time to
  provide private support, and so won't reply to such e-mails.  All such
  questions should be posted on public forums, where I and others can see and
  answer them.

  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Is it possible to rotate screen by program code but not accelerometer sensor?

2010-09-19 Thread Doug
On Sep 19, 1:47 am, HaMMeReD adamhamm...@gmail.com wrote:
 Maybe you can switch between landscape and portrait by modifying the
 activity since it's exposed in the xml it is probably exposed in the
 api too.

Activity.setRequestedOrientation()

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Is it possible to rotate screen by program code but not accelerometer sensor?

2010-09-19 Thread San Zhang
Thank you all for answer.

If there is no system level API, may I control top activity from my service?
for example,  AnyTopActivity.setRequestedOrientation().

2010/9/20 Doug beafd...@gmail.com

 On Sep 19, 1:47 am, HaMMeReD adamhamm...@gmail.com wrote:
  Maybe you can switch between landscape and portrait by modifying the
  activity since it's exposed in the xml it is probably exposed in the
  api too.

 Activity.setRequestedOrientation()

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en


-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Is it possible to rotate screen by program code but not accelerometer sensor?

2010-09-19 Thread San Zhang
Answer my own above question,  it is impossible. Because there is no hotkey
mechanism in android. Maybe need to research android source code to find
solution. Have anyone any suggestion?

2010/9/20 San Zhang dahua007...@gmail.com

 Thank you all for answer.

 If there is no system level API, may I control top activity from my
 service? for example,  AnyTopActivity.setRequestedOrientation().

 2010/9/20 Doug beafd...@gmail.com

  On Sep 19, 1:47 am, HaMMeReD adamhamm...@gmail.com wrote:
  Maybe you can switch between landscape and portrait by modifying the
  activity since it's exposed in the xml it is probably exposed in the
  api too.

 Activity.setRequestedOrientation()

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en




-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Re: Is it possible to rotate screen by program code but not accelerometer sensor?

2010-09-19 Thread Frank Weiss
There is an Auto rotate system setting, but apparently turning it off forces
everything into portrait, at least on my Droid. Seems a little bit weird.

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en