title: Receiving string via android Bluetooth using the BluetoothSocke
body: <p>This code receives the string from an embedded Bluetooth to an Android phone.     I want that when the embedded Bluetooth transmission starts, this function to work and when the embedded Bluetooth is sending 'A' to the phone, change the background of a text view to black and when it is sending 'Z' change the  background to green. This code is not working and the app is turning off when this function gets called after pressing a button. What's the problem?</p>
  
  <pre><code>public void run() {
  
      byte[] buffer = new byte[1024];
  
      while (true) {
          try {
              x= btSocket.getInputStream().read( buffer);
  
              if(x==65)
                  tb.setBackgroundColor(Color.BLACK);
              if(x==90)
                  tb.setBackgroundColor(Color.GREEN);
  
  
          } catch (IOException e) {
              break;
          }
  
      }
  
  }
  </code></pre>