i found a solution of this problem:
in the onSensorChanged function
public void onSensorChanged(int sensor, float[] values) {
/*
that is the normal code with have the problem
            float x=values[0];
            float y=values[1];
            float z=values[2];
which 0,1,2 is the Accelerometer values based on the orientation and this
give an error some time in the landscape orientation
*/
/*
this is the correct code
*/
            float tmpX=values[3];
            float tmpY=values[4];
            float z=values[5];
 /*
where 3,4,5 is the PORTRAIT screen orientation
so if u want to use it in the land scape orientation swap x and y
*/
float x = -1*tmpY;
float y = x;
}


On Sun, May 31, 2009 at 12:57 PM, youssef henry
<[email protected]>wrote:

> i have the same problem, anyone can help?
>
>
> On Fri, May 15, 2009 at 5:06 PM, doubleslash <[email protected]>wrote:
>
>>
>> This problem occurs only when activity is set explicitly to landscape
>> in manifest. Anyway to make it work in landscape?
>> Thanks
>>
>> On May 14, 10:16 pm, doubleslash <[email protected]> wrote:
>> > I see an acceleration of -9 in the y-direction ( due to gravity, of
>> > course). Now, keeping the phone fixed, not rotating the screen or
>> > anything, I interrupt the app my pressing the call button and then
>> > coming back, I see an acceleration of +9 in the x-direction. This
>> > switching of the coordinates happens without onAccuracyChanged being
>> > called, so how on Earth can we consistently use the accelerometer's
>> > output?
>> >
>> > Please shed some light on this. Is this fixed in SDK 1.5?
>> >>
>>
>
>
>
>

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

Reply via email to