Help me! The problem about the sensor!!!

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Help me! The problem about the sensor!!!

Postby wanzi215 » Fri Mar 27, 2009 3:09 am

I use the sensorManager in my application,When I run the application for the first time,the sensorManager can't work correctly. The identify of direction X and direction Y change each other. Then I quit the application and enter application again,all the thing is correct!

The application's screenOrientation is 'landscape' , It's puzzle that when I change to 'portrait',everthing is ok,no any problems!

who can tell me how to resolve this problem?

The code:

SensorManager mSensorManager ;

mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);


public void onSensorChanged(int sensor, float[] values) {
synchronized (this) {
if (sensor == SensorManager.SENSOR_ORIENTATION) {
for (int i=0 ; i<3 ; i++) {
mOrientationValues[i] = values[i] ; //the problem place! the values[1] & values[2] are change each other
//when I enter the game for the first time


please help me !!!!!!!! thanks very much!!!!
Posts: 4
Joined: Mon Mar 23, 2009 2:46 am


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests