Hi: I want to use this listener to catch the screen orientation change. But I don't know how to use it, I tried new it and add my codes in its method onOrientationChanged, the codes looks like: myOrientationListener = new OrientationEventListener(this) { public void onOrientationChanged(int orientation) { System.out.println("**********onOrientationChanged"); if (null == mWebViewState) // save some state for current view so that restore them for new screen orientation ..... } }; myOrientationListener.enable();
I put these codes in onCreate() function, no exception raised when application run, but the screen is black, nothing could be showed in my web browse view. I looked the ddms output: 06-02 18:12:19.708: INFO/System.out(7216): *****onCreate() 06-02 18:12:19.708: INFO/System.out(7216): ********onStart() 06-02 18:12:19.717: DEBUG/qemud(560): fdhandler_accept_event: accepting on fd 10 06-02 18:12:19.717: DEBUG/qemud(560): created client 0xc088 listening on fd 14 06-02 18:12:19.727: DEBUG/qemud(560): client_fd_receive: attempting registration for service 'sensors' 06-02 18:12:19.727: DEBUG/qemud(560): client_fd_receive: -> received channel id 9 06-02 18:12:19.727: DEBUG/qemud(560): multiplexer_handle_control: unknown control message (26 bytes): 'ko:connect:09:service busy' 06-02 18:12:29.197: WARN/ActivityManager(582): Launch timeout has expired, giving up wake lock! Seems the listener register is failed. I don't know why and also don't know how to use it, is it need to register on SensorManager? But I did not find any about register function for it in SensorManager. Could you help me? Thanks a lot! My intent of using it is that I want to keep the same web page and same browsing position in this listener only after screen orientation is changed. If you have another idea for my purpose without using OrientationEventListener, please tell me and thank you very much! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---