Ejemplo n.º 1
0
 // Begin BT communicaction thread
 private void beginCommunication(BluetoothSocket socket) {
   Log.i(TAG, "BonitorActivity - beginComunication()");
   // Begin Bluetooth Communication
   if (communicationThread != null) {
     communicationThread.cancel();
   }
   communicationThread = new CommunicationThread(socket);
   communicationThread.start();
 }
Ejemplo n.º 2
0
 // Back button pressed
 @Override
 public void onBackPressed() {
   Log.e(TAG, "BonitorActivity - onBackPressed()");
   if (connectionThread != null) {
     connectionThread.cancel();
   }
   if (communicationThread != null) {
     communicationThread.cancel();
   }
   if (fileWriter != null) {
     try {
       fileWriter.close();
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
   finish();
 }
Ejemplo n.º 3
0
 // onDestroy
 @Override
 protected void onDestroy() {
   Log.e(TAG, "BonitorActivity - onDestroy()");
   super.onDestroy();
   if (connectionThread != null) {
     connectionThread.cancel();
   }
   if (communicationThread != null) {
     communicationThread.cancel();
   }
   if (fileWriter != null) {
     try {
       fileWriter.close();
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
   finish();
 }