How to use the key event to emulate the acceleration sensor to let the screen change orientation.

by rjy...@gmail.com » Thu, 07 Jan 2010 14:57:15 GMT


Sponsored Links
 Hi
   My hardward has not a acceleration sensor, But I need test screen
change orientation function. So I need emulate this function use the
key. How can I do.
  I seach a lot of infomation from internet, Some proposal is send the
KEY_ROTATE(Key code is 99) to /dev/input/event0,  But no effect.
Thanks.

---------------------------------
RongJun Ying



Other Threads

1. When to add child views to a compound control?

Hi,

I'm trying to make a compound control which looks like the following:

  <LinearLayout>
    <ImageView />
    <ImageView />
    ...
  </LinearLayout>

I want to fill a horizontal linear layout with as many image views as
possible - but only a single row of them. I'm not sure where to add
the image views to the layout at runtime, I am getting inconsistent
results, for example:

  class Foo extends LinearLayout {
      void onLayout(boolean changed, int l, int t, int r, int b) {
          super.onLayout(changed, l, r, t, b);
          addAsManyImageViewsAsCanFit(r-l);
      }

      void addAsManyImageViewsAsCanFit(int width) {
          while (we can fit more) {
              ImageView iv = new ImageView(getContext());
              iv.setLayoutParams(...);
              addView(iv);
          }
      }
  }

I'm sure image views are getting added as child views, but they don't
always take up space in the layout somehow (I'm giving them a fixed
width and height for now). Where should I be adding the image views to
the layout? onLayout? onSizeChanged? After adding each one, do I need
to call requestLayout() or some other method on the parent?

Thanks

-- 

2. How to programatically refresh Gallery View?

I want to programatically refresh Gallery every time I download a
video from my application. It doesn't automatically show up in the
gallery.

Thanks,

AB

-- 

3. How to add a unique label on the OverlayItems?

4. Significance of underlining the word currently typed on an EditText box

5. Application crashes on device boot.

6. Delay in updating the database parameter value

7. New Member