Methods Summary |
---|
static void | log(java.lang.String message)
if (LOG_ENABLED) {
Log.v(LOG_TAG, message);
}
|
public void | onAccuracyChanged(android.hardware.Sensor sensor, int accuracy)
|
public void | onCreate(android.os.Bundle icicle)
super.onCreate(icicle);
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
// Create our Preview view and set it as the content of our
// Activity
mView = new BallsView(this);
setContentView(mView);
|
protected void | onPause()
super.onPause();
mView.pause();
onStop();
|
protected void | onResume()
mSensorManager.registerListener(this,
mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
SensorManager.SENSOR_DELAY_FASTEST);
// Ideally a game should implement onResume() and onPause()
// to take appropriate action when the activity looses focus
super.onResume();
mView.resume();
|
public void | onSensorChanged(android.hardware.SensorEvent event)
// get the current looper (from your Activity UI thread for instance
//android.util.Log.d("rs", "sensor: " + event.sensor + ", x: " + event.values[0] + ", y: " + event.values[1] + ", z: " + event.values[2]);
synchronized (this) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
if(mView != null) {
mView.setAccel(event.values[0], event.values[1], event.values[2]);
}
}
}
|
protected void | onStop()
mSensorManager.unregisterListener(this);
super.onStop();
|