About rotate screen use G-SENSOR

by lgbk » Mon, 17 May 2010 15:42:14 GMT

Sponsored Links
 Hi all,
  I'm debuging my gsensor in my devices.And now in my sensor HAL layer
code ,I return two types data.(ID_ACCELERATION and ID_ORIENTATION).I'm
confused how covert x,y,z data to pitch,roll.....In my code I use
                  pitch = atan(sensors.acceleration.y/
                  roll = atan(sensors.acceleration.x/
                  sensors.orientation.azimuth = 0.0;
But it seems have some error.Now I can not rotate my screen
automaitic,but can play some g-sensor game,like(labyrinthfull.apk).So
my question is that ,if I want to rotate screen automatic,which data
the system need to use?x,y,z? or pitch roll azimuth? or antoher data?
Can somebody show me some example,thanks.Any suggestion is appracite.


About rotate screen use G-SENSOR

by lgbk » Mon, 17 May 2010 17:28:26 GMT

 Some guys told me the sensor raw data is enough.So if it is right ,I
think the raw data I have covert and report successfull.So maybe I
forget some config in system.I also heared that I need config
something in init,rc but I didn,t know what need I add.Can anybody
told me or give me some suggestion,thanks!!!


Sponsored Links

Other Threads

1. Read from sdcard problem (version 1.6)

Hello I'm trying to make a photo calling the CAMERA Intent an after
returning to my application read the file, but altough I get a File
like /sdcard/DCIM/camera/XXXX.jpg if I try to open the file, it exist
and can be read (check with File.exist or File.canread BUT the length
of the file is always 0...

More or less my code is:
call the camera intent like:
Uri imageUri =
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);

in the onActivityResult I do this:

get the File from the Uri, something like (cut&paste from internet):
                Cursor cursor = null;
                try {
                    String [] proj={MediaStore.Images.Media.DATA,
                    cursor = activity.managedQuery( imageUri, proj, null, null,
                    int file_ColumnIndex =
                    int orientation_ColumnIndex =
                    if (cursor.moveToFirst()) {
                        String orientation =
                        return new File(cursor.getString(file_ColumnIndex));
                    return null;
                } finally {
                    if (cursor != null) {

So I get a File like /sdcard/DCIM/Camera/XXXXXXXXX.jpg
So if I do:
file.exists()  --> true
file.canRead() --> true
file.length()  --> 0 !!!
So I cant read the file from sdcard (if I try to ignore the size and
simply open a FileInputStream and read it reads of course 0 bytes...

So where is the problem?
I'm stuck on this...

Best regards.


2. LVL buy now button.

Hi all,
is it normal that this code open the browser and returns a 404 error
in the emulator?

Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
id=" + getPackageName()));

Should work fine on real device, am I right?



3. Google browser certificate issue

4. Oracle sues Google over Android and Java

5. Tiff Codec

6. Invoking A Web Service Through A Button

7. Mic Not working in Android Donut