Click here to Skip to main content
15,881,516 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
1.how to store the accelerometer data in the database.

2.what is the maximum rang of the accelerometer data.for example

what will be the rang of x,y and z such that "x"+event.values[0]

show the maximum rang is 9.
3.the following is the code
Java
public class MainActivity extends Activity implements SensorEventListener {
TextView acceleration;
 @Override
 protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);


    SensorManager sm=(SensorManager)getSystemService(SENSOR_SERVICE);
    Sensor accelerometer=sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
  sm.registerListener(this,accelerometer,SensorManager.SENSOR_DELAY_NORMAL);
    TextView acceleration=(TextView)findViewById(R.id.acceleration);

    }


   @Override
   public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
    return true;
   }

   @Override
   public void onAccuracyChanged(Sensor arg0, int arg1) {
    // TODO Auto-generated method stub

    }

   @Override
   public void onSensorChanged(SensorEvent event) {
    // TODO Auto-generated method stub

       acceleration.setText("x:"+event.values[0]+"\n"+"y:"+event.values[1]+"\n"+"z:"+event.values[2]);

  }

 }

4.For storing the data in the database how many tables are require.
5.is it require 3 tables.for example one table for x,one table for y,one table for z.
6.i want to store the data then compare the stored data and if its maximum so then show that its runing.
7.if its medium then show its walking.
8.if its low than show its sleeping.
Posted
Updated 20-Jul-15 3:46am
v2
Comments
wajib rehman 26-Jul-15 22:44pm    
Is it fine to use one table for storing accelerometer data?

1 solution

This looks awfully like a homework and we do not do those. The best way to learn is to try to figure things out by yourself. By letting other people do the thinking for you, you don't learn. So taking the time and trying is an investment to yourself that you will thank later.

If you have already done something and you're stuck in a specific question, people will help you to get the answer. But in order to achieve that, you need show what you have done and where you're stuck at.
 
Share this answer
 
Comments
wajib rehman 22-Jul-15 4:03am    
ok i have stored the accelerometer data in one table in database.
so how i can campare that if the table value is greater then 10 show that its runing
Wendelius 23-Jul-15 4:40am    
Do you mean how you query the rows having a greater value than 10? If that is the question then something like

SELECT * FROM TableName WHERE ColumnName > 10

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900