Good morning,
I'm new in Android development, before I deveped some application/website in C#/ASP.NET with Microsoft SQL Server. Now I've to develop a Android application to detect when I person falls down and send an alarm. I found an examples like this:
public class MainActivity extends Activity implements SensorEventListener{
private SensorManager sensorManager;
TextView text_X;
TextView text_Y;
TextView text_Z;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
sensorManager.registerListener(this, sensorManager.getDefaultSensor( Sensor.TYPE_ACCELEROMETER ),SensorManager.SENSOR_DELAY_NORMAL );
//Collegamento con le textView del layout
text_X=(TextView)findViewById(R.id.txtXValue);
text_Y=(TextView)findViewById(R.id.txtYValue);
text_Z=(TextView)findViewById(R.id.txtZValue);
}
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
//L'accelerometro ha cambiato stato
mostraValori(event);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
private void mostraValori(SensorEvent event){
float[] valori=event.values;//array che contiene i valori dell'accelerometro
//modifica del valore delle textView
text_X.setText("Valore X: "+valori[0]);
text_Y.setText("Valore Y: "+valori[1]);
text_Z.setText("Valore Z: "+valori[2]);
}
}
So I've accelerometer's X, Y and Z values on the screen. Now what is the next step?
Thank you.