Android Camera API
<p>I have created a camera API for android. That works fine. Now I am trying to automatically turn on that if accelerometer reading > 2.0 (Gforce > 2.0) I have written a activity to measure the force as well. But that part is not working. (When I check the accelerometer part separately It works fine. But when I add that to the camera project It is not working ) How can I correct this. 
I have refer the below link to make the camera.
<a href="http://marakana.com/forums/android/examples/39.html" rel="nofollow">http://marakana.com/forums/android/examples/39.html</a></p>

<p>And below is my code for accelerometer</p>

<pre><code>package com.example;

import java.text.DecimalFormat;
import java.util.Timer;
import java.util.TimerTask;



import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.widget.TextView;


public class Measure extends Activity{

    SensorManager sensorManager;
    TextView current;


    private double currentAccel= 0.0f;
    private static DecimalFormat REAL_FORMATTER = new DecimalFormat("0.####");


    private final SensorEventListener sensorEvent = new SensorEventListener(){
        double calibration = SensorManager.STANDARD_GRAVITY;

        @Override
        public void onAccuracyChanged(Sensor sensor, int accuracy) {

        }
        @Override
        public void onSensorChanged(SensorEvent event) {
                double x = event.values[0];
                double y = event.values[1];
                double z = event.values[2];

                double a = Math.round(Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2) + Math.pow(z, 2)));
                currentAccel = ((float)(a-calibration));

        }
};

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);


        current = (TextView)findViewById(R.id.current);
        current.setTextSize(1, 30);

        sensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE);
        Sensor accelerometer = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
        sensorManager.registerListener(sensorEvent, accelerometer, SensorManager.SENSOR_DELAY_FASTEST);

        Timer updateTimer = new Timer("gForceUpdate");
        updateTimer.scheduleAtFixedRate(new TimerTask(){
                public void run() {
                        updateGUI();
                }
        }, 0, 50);

    }

    private void updateGUI(){
        runOnUiThread(new Runnable(){
                @Override
                public void run() {


                       double currentG = currentAccel / SensorManager.STANDARD_GRAVITY ;

                       current.setText(REAL_FORMATTER.format(currentG));

                      /* if(currentG&gt;2.3){
                           CameraDemo obj = new CameraDemo();


                        String acl=Double.toString((Double)currentG);
                        String result=obj.sendAccelerationData(acl);

                        }
                        */
                }
        });
}

}
</code></pre>
