@@ -0,0 +1,2596 @@
+package com.example.untitled;%0A%0Aimport android.app.Activity;%0Aimport android.hardware.Sensor;%0Aimport android.hardware.SensorEvent;%0Aimport android.hardware.SensorEventListener;%0Aimport android.hardware.SensorManager;%0Aimport android.os.Bundle;%0A//import android.content.DialogInterface;%0Aimport android.os.Vibrator;%0Aimport android.util.Log;%0Aimport android.view.View;%0Aimport android.widget.Button;%0Aimport android.widget.EditText;%0Aimport android.widget.TextView;%0A%0Apublic class MyActivity extends Activity %7B%0A    /**%0A     * Called when the activity is first created.%0A     */%0A    Button host, connect;%0A    TextView txtInfo;%0A    EditText txtIP;%0A    Vibrator vibe;%0A    SensorManager sensorManager;%0A    Sensor sensor;%0A%0A    @Override%0A    public void onCreate(Bundle savedInstanceState) %7B%0A        super.onCreate(savedInstanceState);%0A        setContentView(R.layout.main);%0A        host = (Button) findViewById(R.id.butHost);%0A        connect = (Button) findViewById(R.id.butConnect);%0A        txtInfo = (TextView) findViewById(R.id.txtInfo);%0A        txtIP = (EditText) findViewById(R.id.txtIP);%0A%0A        host.setOnClickListener(onClickListener);%0A        connect.setOnClickListener(onClickListener);%0A%0A        initializeVibrator();%0A        initializeSensors();%0A    %7D%0A%0A    void initializeVibrator() %7B%0A        vibe = (Vibrator) getSystemService(SENSOR_SERVICE);%0A    %7D%0A%0A    SensorEventListener eventListener = new SensorEventListener() %7B%0A        public void onSensorChanged(SensorEvent event) %7B%0A            if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) %7B%0A                txtInfo.setText(String.valueOf(event.values%5B0%5D));%0A                Log.i(%22workshop%22,String.valueOf(event.values%5B0%5D));%0A            %7D%0A        %7D%0A%0A        public void onAccuracyChanged(Sensor sensor, int accuracy) %7B%0A%0A        %7D%0A    %7D;%0A%0A%0A    void initializeSensors() %7B%0A        sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);%0A        Sensor sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);%0A        sensorManager.registerListener(eventListener, sensor, SensorManager.SENSOR_DELAY_GAME);%0A    %7D%0A%0A    View.OnClickListener onClickListener = new View.OnClickListener() %7B%0A        @Override%0A        public void onClick(View v) %7B%0A            if (v.equals(host)) %7B%0A                Server server = new Server(null);%0A                server.start();%0A                Log.i(%22workshop%22,%22host%22);%0A            %7D else if (v.equals(connect)) %7B%0A                Client client = new Client(String.valueof(txtIP.getText()));%0A                client.start();%0A                Log.i(%22workshop%22,%22connect%22);%0A            %7D%0A        %7D%0A    %7D;%0A%7D%0A

Create MyActivity.java