android.hardware

by Ivan Longin » Fri, 23 Apr 2010 08:04:47 GMT


Sponsored Links
 Hi!

Does anyone know where to find source code for android.hardware
package? I need to make some modification in SensorManager for my
application and possible modification in other classes from that
package. Google didn't help me a lot so I'm asking here.

Thanks!

--



android.hardware

by Ivan Longin » Fri, 23 Apr 2010 08:04:57 GMT


 Hi!

Does anyone know where to find source code for android.hardware
package? I need to make some modification in SensorManager for my
application and possible modification in other classes from that
package. Google didn't help me a lot so I'm asking here.

Thanks!

--


Sponsored Links


Other Threads

1. HELP! View layout issue

Hey guys,

I am trying to define a view with the following requirements:

1. the view should occupy the entire screen, except the notification area
(the top small bar)
2. The view should be even split into three parts, the top and bottom are
two huge buttons, and the middle is a scrollable list. Note: no matter how
many items in the list, it should only take 1/3 of view space.

I created the following layout xml, but it has dimension hard coded, which
is obviously undesired.

What's the right way to do this?

Thanks in advance!
Xin


My code (obviously not desired):
-------------------------------------------------------
<TableLayout
android:id="@+id/widget146"
android:layout_width="320px"
android:layout_height="480px"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android"
<TableRow
android:id="@+id/widget147"
android:layout_width="fill_parent"
android:layout_height="116px"
android:orientation="horizontal"

  <Button
      android:id="@+id/favorite_card"
      android:text="@string/favorite_card"
      android:keepScreenOn="true"
      android:layout_width="fill_parent"
      android:layout_height="110px"
      android:textSize="45px"/>

</TableRow>

<TableRow
android:id="@+id/widget149"
android:layout_width="fill_parent"
android:layout_height="180px"
android:orientation="horizontal"

  <ScrollView
      android:id="@+id/ScrollView_CardSelector"
      android:layout_width="fill_parent"
      android:layout_height="180px"
      android:scrollbars="none" >

    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="180px">

       <ListView android:id="@android:id/list"
             android:typeface="sans"
             android:textSize="20sp"
             android:layout_width="fill_parent"
             android:layout_height="180px"
             android:animationCache="true"/>
    </LinearLayout>
  </ScrollView>
</TableRow>

<TableRow
android:id="@+id/widget151"
android:layout_width="fill_parent"
android:layout_height="116px"
android:orientation="horizontal"
  <Button
      android:id="@+id/direct_call"
      android:text="@string/direct_call"
      android:keepScreenOn="true"
      android:layout_width="fill_parent"
      android:layout_height="110px"
      android:textSize="45px"/>

</TableRow>

</TableLayout>

--~--~---------~--~----~------------~-------~--~----~

2. Using the Accelerometer

Hi everyone,

I'm a software engineering student and I've just bought a T-Mobile G1
to have a play with :)

I'm wanting to write an app that will untilise the Accelerometer but I
only seem to be able to read orientation values from it.  Heres my
code:


package naxtek.app2;

import android.app.Activity;
import android.hardware.SensorListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;



public class HelloWorld extends Activity implements SensorListener {
           /** Called when the activity is first created. */

           LinearLayout vg;
                TextView tv;
            private SensorManager sensorManager;

           @Override
           public void onCreate(Bundle savedInstanceState) {
               super.onCreate(savedInstanceState);
              tv = new TextView(this);
              vg = new LinearLayout(this);

               vg.addView(tv);
               setContentView(vg);
               sensorManager = (SensorManager) getSystemService
(SENSOR_SERVICE);
               sensorManager.registerListener
(this,SensorManager.SENSOR_ACCELEROMETER,
                                   SensorManager.SENSOR_DELAY_GAME);
           }

        public void onAccuracyChanged(int sensor, int accuracy) {
                // TODO Auto-generated method stub

        }

        public void onSensorChanged(int sensor, float[] values) {
                // TODO Auto-generated method stub
                tv.setText("1: ".concat(Float.toString(values[0]))
                                .concat("\n2: 
".concat(Float.toString(values[1])))
                                .concat("\n3: 
".concat(Float.toString(values[2])))
                                .concat("\n4: 
".concat(Float.toString(values[3])))
                                .concat("\n5: 
".concat(Float.toString(values[4])))
                                .concat("\n6: 
".concat(Float.toString(values[5])))

                );
        }
}

The app runs and works, but all the float values in the array are
orientation based readings.  They are nothing to do with acceleration
or G-Forces.

Can anyone give me any pointers as to what to do?

--~--~---------~--~----~------------~-------~--~----~

3. Custom dialog in PreferenceActivity loaded from addPreferencesFromResource()?

4. Should cursors used in autocomplete adapters be managed or not?

5. Is Google being overly harsh on "cheap" apps

6. How to get current page content of WebView

7. ListView set default checked state