How to draw a trajectory with coordinate X,Y in Android?
<p>I integrate the acceleration to find position using Verlet method here is my code.</p>

<pre><code>package com.test.accelo;
import android.app.Activity;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.view.Display;
import android.view.Surface;
import android.widget.TextView;


public class AccelerometreActivity extends Activity implements SensorEventListener {
/** Called when the activity is first created. */
private Display mDisplay; 


SensorManager sm;
boolean acceltest;
TextView t1,t2,t3;

   public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    sm=(SensorManager) getSystemService(SEARCH_SERVICE);


  }@Override
  protected void onResume() {
            super.onResume();
               acceltest=sm.registerListener(this,sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),SensorManager.SENSOR_DELAY_UI);
        if(! acceltest){
            sm.unregisterListener(this,sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER));
}}
         protected void onStop() {

            super.onStop();
            sm.unregisterListener(this,sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER));
        }

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

}
@SuppressWarnings("null")
public void onSensorChanged(SensorEvent event) {
    // TODO Auto-generated method stub

    float x = 50,y=50,z = 50;
    final long mSensorTimeStamp = 0;
    final long mCpuTimeStamp = 0;
    if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER){

        switch (mDisplay.getRotation()) {
        case Surface.ROTATION_0:
            x = event.values[0];
            y = event.values[1];
            break;
        case Surface.ROTATION_90:
            x = -event.values[1];
            y = event.values[0];
            break;
        case Surface.ROTATION_180:
            x = -event.values[0];
            y = -event.values[1];
            break;
        case Surface.ROTATION_270:
            x = event.values[1];
            y = -event.values[0];
            break;
        }

        z = event.values[2];


    }
              final float alpha = (float) 0.8;

              float[] gravity = null;
            gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
              gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
              gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];

              float[] linear_acceleration = null;
            linear_acceleration[0] = event.values[0] - gravity[0];
              linear_acceleration[1] = event.values[1] - gravity[1];
              linear_acceleration[2] = event.values[2] - gravity[2];
              final float sx = linear_acceleration[1];
              final float sy = linear_acceleration[2];




        float mPosX=0;
         float mPosY=0;
         float mAccelX = 0;
         float mAccelY=0;
         float mLastPosX=0;
         float mLastPosY=0;




            final long dT = mSensorTimeStamp + (System.nanoTime() - mCpuTimeStamp);
            final float dTdT = dT * dT;

            final float x1 = 2*(mPosX )- mLastPosX + mAccelX* dTdT;

            final float y1 = 2*(mPosY)  - mLastPosY + (mAccelY)*dTdT;


                    mLastPosX = mPosX;

            mLastPosY = mPosY;
            mPosX = x1;
            mPosY = y1;
            mAccelX = sx;
            mAccelY = sy;    `
</code></pre>

<p>How to draw the path from the position I have already calculated?</p>

<p>I mean  with coordinates X and Y.</p>
