Java 应用程序已使用传感器加速度计和蓝牙崩溃

Java 应用程序已使用传感器加速度计和蓝牙崩溃,java,android,xml,bluetooth,accelerometer,Java,Android,Xml,Bluetooth,Accelerometer,我编译应用程序时没有错误,但在我的android手机上运行后,应用程序立即崩溃。有人能帮我吗 logcat错误 06-02 17:08:14.925: D/AndroidRuntime(4653): Shutting down VM 06-02 17:08:14.925: W/dalvikvm(4653): threadid=1: thread exiting with uncaught exception (group=0x40b8c930) 06-02 17:08:14.935: E/A

我编译应用程序时没有错误,但在我的android手机上运行后,应用程序立即崩溃。有人能帮我吗

logcat错误

06-02 17:08:14.925: D/AndroidRuntime(4653): Shutting down VM
06-02 17:08:14.925: W/dalvikvm(4653): threadid=1: thread exiting with uncaught   exception (group=0x40b8c930)
06-02 17:08:14.935: E/AndroidRuntime(4653): FATAL EXCEPTION: main
06-02 17:08:14.935: E/AndroidRuntime(4653): java.lang.RuntimeException: Unable to start   activity    ComponentInfo{com.example.sensormobileaty/com.example.sensormobileaty.MainActivity}: java.lang.NullPointerException
06-02 17:08:14.935: E/AndroidRuntime(4653):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2308)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at     android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at android.app.ActivityThread.access$600(ActivityThread.java:153)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at android.os.Looper.loop(Looper.java:137)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at android.app.ActivityThread.main(ActivityThread.java:5227)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at java.lang.reflect.Method.invokeNative(Native Method)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at java.lang.reflect.Method.invoke(Method.java:511)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at dalvik.system.NativeStart.main(Native Method)
06-02 17:08:14.935: E/AndroidRuntime(4653): Caused by: java.lang.NullPointerException
06-02 17:08:14.935: E/AndroidRuntime(4653):     at com.example.sensormobileaty.MainActivity.onCreate(MainActivity.java:28)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at android.app.Activity.performCreate(Activity.java:5104)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-02 17:08:14.935: E/AndroidRuntime(4653):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2262)
06-02 17:08:14.935: E/AndroidRuntime(4653):     ... 11 more
06-02 17:08:26.036: I/Process(4653): Sending signal. PID: 4653 SIG: 9
MainActivity.java

import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.Fragment;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends ActionBarActivity {

Context myContext = this;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    AlertDialog.Builder builder = new AlertDialog.Builder(myContext);

    Button buttonConnect = (Button) findViewById (R.id.connectNew);
    buttonConnect.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) 
        {
            startActivity(new Intent(MainActivity.this, ScanForBluetoothDevices.class));
        }

    });

    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, new PlaceholderFragment()).commit();
    }
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.main, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.action_settings) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}

public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_main, container,
                false);
        return rootView;
    }
}

}
BluetoothServerHelper.java

import java.io.IOException;
import java.util.UUID;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import android.os.Handler;
import android.os.Message;
import android.util.Log;

public class BluetoothServerHelper extends Thread 
{
public BluetoothServerHelper (BluetoothDevice mmDevice, Handler mmHandler) 
{
    this.mmDevice = mmDevice;
    this.mmHandler = mmHandler;
}

// IMPORTANT THIS IS SERVICE URL TO CONNECT
        UUID mmUUID = UUID.fromString("8d53e166-22d5-48bd-9451-35a8d2eb902d");

        BluetoothDevice mmDevice;
        Handler mmHandler;

        @Override
        public void run() {

            // IMPORTANT TO CANCEL DISCOVERY BEFORE TRY TO CONNECT
            BluetoothAdapter.getDefaultAdapter().cancelDiscovery();

            BluetoothSocket mmSocket = null;
            Message m = new Message();

            try
            {
                mmSocket = mmDevice.createRfcommSocketToServiceRecord(mmUUID);
                mmSocket.connect();
            } catch (IOException e)
            {

                m.what = -1; // CONNECTION FAILED
                m.obj = e.getMessage(); // SEND FAILURE MESSAGE
                if (mmHandler != null)
                    mmHandler.sendMessage(m);
                Log.d("App_Debug", "Failed To connect to UUID");
                return;

            }

            m.what = 1; // CONNECTION SUCESSED
            m.obj = mmSocket; // SEND CONNECTED SOCKET
            if (mmHandler != null)
                mmHandler.sendMessage(m);
        }

}
SensorPanel.java

import java.io.DataOutputStream;
import java.io.IOException;
import android.app.Activity;
import android.bluetooth.BluetoothSocket;
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.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.widget.TextView;
import android.widget.Toast;

public class SensorPanel extends Activity implements SensorEventListener
{

//Button Button_Touch_Left;
//Button Button_Touch_Right;
BluetoothSocket bSocket = null;
DataOutputStream mmOutputStream;
GestureDetector mmGestureDetector;

float [] history = new float[3];
//private float mLastX,mLastY,mLastZ;
private boolean mInitialized = true;
private SensorManager mSensorManager;
private Sensor mAccelerometer;
private final float NOISE = (float) 2.0;

@Override
protected void onCreate(Bundle savedInstanceState)
{

    super.onCreate(savedInstanceState);
    setContentView(R.layout.mouse_sensor_panel);
    //Button_Touch_Left = (Button) findViewById(R.id.Button_Touch_Left);
    //Button_Touch_Right = (Button) findViewById(R.id.Button_Touch_Right);
    //View Touch_Panel = (View) findViewById(R.id.View_Touch_Panel);
    //Sensor
    mInitialized = false;
    mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
    mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
    mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);

    int id = getIntent().getExtras().getInt("BLUETOOTHSOCKET");

    // TRY TO CONNECT
    Object obj = Globals.getGlobal().getTransferedObject(id);
    bSocket = (BluetoothSocket) obj;

    if (bSocket == null)
    {
        Toast.makeText(this, "NULLSOCKET", Toast.LENGTH_SHORT).show();
        Log.d("App_Debug", "NullSOCKET");
        finish();
        return;
    }

    try
    {
        mmOutputStream = new DataOutputStream(bSocket.getOutputStream());
    } catch (IOException e)
    {
        Toast.makeText(this, e.getMessage(), Toast.LENGTH_SHORT).show();
        finish();

        return;}
    }

    //PREPARE
    /**Touch_Panel.setOnTOuchListener(new onTouchListener()

    {

        @Override
        public boolean onMoveCommand(float X, float Y)
        {

            switch (event.getAction())
            {
            case MotionEvent.ACTION_DOWN:
                v.setPressed(true);
                writeMessage(BlueMoProtocol.ACTION_MOUSE_LEFT_BUTTON_DOWN);
                return true;

            case MotionEvent.ACTION_UP:
                v.setPressed(false);
                writeMessage(BlueMoProtocol.ACTION_MOUSE_LEFT_BUTTON_UP);
                return true;
            }
            return false;
        }
    });**/

    /**Button_Touch_Right.setOnTouchListener(new OnTouchListener()
    {

        @Override
        public boolean onTouch(View v, MotionEvent event)
        {

            switch (event.getAction())
            {
            case MotionEvent.ACTION_DOWN:
                v.setPressed(true);
                writeMessage(BlueMoProtocol.ACTION_MOUSE_RIGHT_BUTTON_DOWN);
                return true;

            case MotionEvent.ACTION_UP:
                v.setPressed(false);
                writeMessage(BlueMoProtocol.ACTION_MOUSE_RIGHT_BUTTON_UP);
                return true;
            }
            return false;
        }
    });

    mmGestureDetector = new GestureDetector(this, this);
    mmGestureDetector.setIsLongpressEnabled(false);
    mmGestureDetector.setOnDoubleTapListener(this);
}**/

private void closeBluetoothSockets()
{
    if (bSocket != null)
    {
        try
        {
            bSocket.close();
        } catch (IOException e)
        {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}

@Override
public void onDestroy()
{
    super.onDestroy();
    closeBluetoothSockets();
}

private void showToast(String message)
{
    Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
}

private void writeMessage(int msg, int x, int y)
{
    try
    {
        mmOutputStream.writeInt(msg);
        mmOutputStream.writeInt(x);
        mmOutputStream.writeInt(y);
        mmOutputStream.flush();
    } catch (IOException e)
    {
        showToast(e.getMessage());
        finish();
        LOGd(e.getMessage());
    }
}

private void writeMessage(int msg)
{
    try
    {
        mmOutputStream.writeInt(msg);
        mmOutputStream.flush();
    } catch (IOException e)
    {
        showToast(e.getMessage());
        finish();
        LOGd(e.getMessage());
    }

}

private void LOGd(String message)
{
    Log.d("App_Debug", message);
}

/**@Override
public boolean onDown(MotionEvent arg0)
{
    // LOGd("onDown");
    return true;
}

@Override
public boolean onFling(MotionEvent arg0, MotionEvent arg1, float arg2, float arg3)
{
    // LOGd("onFling");
    return false;
}

@Override
public void onLongPress(MotionEvent e)
{
    // LOGd("onLongPress");
}

@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY)
{
    // LOGd("onScroll");
    // LOGd(e1.getX() + " " + e1.getY() + " || " + e2.getX() + " " +
    // e2.getY() + "||" + distanceX + " " + distanceY);
    writeMessage(BlueMoProtocol.ACTION_MOVE, (int) distanceX, (int) distanceY);
    return true;
}

@Override
public void onShowPress(MotionEvent e)
{
    // LOGd("onShowPress");
}

@Override
public boolean onSingleTapUp(MotionEvent e)
{
    // LOGd("onSingleTapUp");
    return false;
}

// boolean doubleTappMoved = false;

@Override
public boolean onDoubleTap(MotionEvent e)
{
    // doubleTappMoved = false;
    // LOGd("onDoubleTap");
    return true;

}**/

boolean mmDoubleClickConfirmed;
long mmMovesAfterDoubleClick = 0;
float mLastX, mLastY, mLastZ;
final long doubleClickMovesErrorRate = 3;

public boolean onDoubleTapEvent(MotionEvent e)
{
    final float xDelta, yDelta;
    switch (e.getAction())
    {

    /**case MotionEvent.ACTION_DOWN:
        mmDoubleClickConfirmed = true;
        mmMovesAfterDoubleClick = 0;
        writeMessage(BlueMoProtocol.ACTION_MOUSE_LEFT_BUTTON_DOWN);
        myLastTouchX = e.getX();
        myLastTouchY = e.getY();
        return true;**/

    case MotionEvent.ACTION_MOVE:
        mmDoubleClickConfirmed = false;
        mmMovesAfterDoubleClick++;
        xDelta = mLastX - e.getX();
        yDelta = mLastY - e.getY();
        writeMessage(BlueMoProtocol.ACTION_MOVE, (int) xDelta, (int) yDelta);
        mLastX = e.getX();
        mLastY = e.getY();
        return true;

    /**case MotionEvent.ACTION_UP:
        if (mmDoubleClickConfirmed || mmMovesAfterDoubleClick > doubleClickMovesErrorRate)
        {
            // DoubleClick
            writeMessage(BlueMoProtocol.ACTION_MOUSE_LEFT_BUTTON_UP);
            writeMessage(BlueMoProtocol.ACTION_SINLE_TAPP);
        } else
        {
            // Drag
            writeMessage(BlueMoProtocol.ACTION_MOUSE_LEFT_BUTTON_UP);
        }
        return true;**/

    }
    return false;
}

/**@Override
public boolean onSingleTapConfirmed(MotionEvent e)
{
    writeMessage(BlueMoProtocol.ACTION_SINLE_TAPP);
    // LOGd("onSingleTapConfirmed");
    return true;
}**/

protected void onResume() {
    super.onResume();
    mSensorManager.registerListener(this, mAccelerometer, SensorManager.SENSOR_DELAY_NORMAL);
}

protected void onPause() {
    super.onPause();
    mSensorManager.unregisterListener(this);
}

@Override
public void onSensorChanged(SensorEvent event) {
    // TODO Auto-generated method stub
    TextView tvX = (TextView) findViewById (R.id.xcoor);
    TextView tvY = (TextView) findViewById (R.id.ycoor);
    TextView tvZ = (TextView) findViewById (R.id.zcoor);
    TextView tvC = (TextView) findViewById (R.id.clickGesture);
    float zChanged = history[2] - event.values[2];
    float threshold = 3.0f;
    history[2] = event.values[2];
    float X = event.values [0];
    float Y = event.values [1];
    float Z = event.values [2];

    if (!mInitialized) {
        mLastX = X;
        mLastY = Y;
        mLastZ = Z;
        tvX.setText("0.00");
        tvY.setText("0.00");
        tvZ.setText("0.00");
        mInitialized = true;
    } else  {
        float deltaX = Math.abs(mLastX - X);
        float deltaY = Math.abs(mLastY - Y);
        float deltaZ = Math.abs(mLastZ - Z);
        if (deltaX < NOISE) deltaX = (float) 0.0;
        if (deltaY < NOISE) deltaY = (float) 0.0;
        if (deltaZ < NOISE) deltaZ = (float) 0.0;
        mLastX = X;
        mLastY = Y;
        mLastZ = Z;
        tvX.setText(Float.toString(deltaX));
        tvY.setText(Float.toString(deltaY));
        tvZ.setText(Float.toString(deltaZ));
        writeMessage(BlueMoProtocol.ACTION_MOVE);
    } if (zChanged > threshold) {
        tvC.setText("1");
        writeMessage(BlueMoProtocol.ACTION_SINGLE_TAP);
    } else if (zChanged < threshold) {
        tvC.setText("0");

    }

}

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

}

}
fragment_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.sensormobileaty.MainActivity$PlaceholderFragment" >

<Button
    android:id="@+id/connectNew"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="40dp"
    android:text="@string/connect" />

</RelativeLayout>
鼠标传感器面板.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
    android:id="@+id/sensorCoordinate"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:text="@string/coordinate"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TableLayout
    android:id="@+id/tableLayout1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/sensorCoordinate" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/x_axis" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/y_axis" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/z_axis" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/click" />

    </TableRow>
</TableLayout>

<TableLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/tableLayout1"
    android:layout_toRightOf="@+id/tableLayout1" >

    <TableRow
        android:id="@+id/tableRow5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/xcoor"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/ycoor"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/zcoor"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/clickGesture"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </TableRow>
</TableLayout>


</RelativeLayout>
扫描蓝牙设备.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ListView
    android:id="@+id/listView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/tvPD"
    android:layout_above="@+id/bScan" >

</ListView>

<Button
    android:id="@+id/bScan"
    android:layout_width="150dp"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:text="@string/scan" />

<TextView
    android:id="@+id/tvPD"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:text="@string/paired_devices" />

<Button
    android:id="@+id/bCancel"
    android:layout_width="150dp"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:text="@string/cancel" />

</RelativeLayout>

总结错误消息:您有一个NullPointerException,您试图访问一个空的对象函数变量,即未设置/初始化,此错误发生在文件MainActivity.java的第28行。您发布的文件是main_activity.java。这是打字错误还是您有两个mainactivity类?按钮在您的片段中,而不是在activity_主布局中。看@peant,那是个打字错误。对不起,我弄错了。谢谢@laalto。当我将活动_main更改为片段_main时。这个错误出现了。你能解释一下这个错误是什么意思吗找不到id为0x7f05003c com.example.sensormobileaty:id/片段占位符片段容器片段{40e30b10 id=0x7f05003c}'您的活动内容视图没有您尝试随片段事务附加的片段容器。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.sensormobileaty.MainActivity$PlaceholderFragment" >

<Button
    android:id="@+id/connectNew"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="40dp"
    android:text="@string/connect" />

</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
    android:id="@+id/sensorCoordinate"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:text="@string/coordinate"
    android:textAppearance="?android:attr/textAppearanceLarge" />

<TableLayout
    android:id="@+id/tableLayout1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/sensorCoordinate" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/x_axis" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/y_axis" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/z_axis" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/click" />

    </TableRow>
</TableLayout>

<TableLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignTop="@+id/tableLayout1"
    android:layout_toRightOf="@+id/tableLayout1" >

    <TableRow
        android:id="@+id/tableRow5"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/xcoor"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/ycoor"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/zcoor"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </TableRow>

    <TableRow
        android:id="@+id/tableRow8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <TextView
            android:id="@+id/clickGesture"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

    </TableRow>
</TableLayout>


</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<ListView
    android:id="@+id/listView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_below="@+id/tvPD"
    android:layout_above="@+id/bScan" >

</ListView>

<Button
    android:id="@+id/bScan"
    android:layout_width="150dp"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:text="@string/scan" />

<TextView
    android:id="@+id/tvPD"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true"
    android:text="@string/paired_devices" />

<Button
    android:id="@+id/bCancel"
    android:layout_width="150dp"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentRight="true"
    android:text="@string/cancel" />

</RelativeLayout>