public void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    switch (paramInt1)
    {
    default:
    case 1:
    }
    do
      return;
    while (paramInt2 != -1);
     String str = paramIntent.getExtras().getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS);        // paramIntent.getExtras().getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS);
    this._device = this._bluetooth.getRemoteDevice(str);
    try
    {
      this._socket = this._device.createRfcommSocketToServiceRecord(UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"));
       // localButton = (Button)findViewById(2130968586);//2131099658
        Button localButton = (Button)findViewById(2130968586);
    }
    catch (IOException localIOException2)
    {
      try
      {
        Button localButton;
        this._socket.connect();
        Toast.makeText(this, "连接" + this._device.getName() + "成功!", 0).show();
        localButton.setText("断开");       
      }
      catch (IOException localIOException2)
      {
        try
        {
          while (true)
          {
            this.is = this._socket.getInputStream();
            if (this.bThread)
              break;
            this.ReadThread.start();
            this.bThread = true;
            return;
            localIOException1 = localIOException1;
            Toast.makeText(this, "连接失败!", 0).show();
          }
          localIOException2 = localIOException2;
          try                 
          {
            Toast.makeText(this, "连接失败!", 0).show();
            this._socket.close();
            this._socket = null;
            return;
          }
          catch (IOException localIOException3)
          {
            Toast.makeText(this, "连接失败!", 0).show();
            return;
          }
        }
        catch (IOException localIOException4)
        {
          Toast.makeText(this, "接收数据失败!", 0).show();
          return;
        }
      }
    }
    this.bRun = true;
  }
这段老是报错,没办法编译其中      catch (IOException localIOException2)
老是提示Multiple ers at this line
- Syntax error on token "localIOException2", 
 VariableDeclaratorId expected after this token
- localIOException2 cannot be resolved to a type
- Duplicate parameter localIOException2
如果把其中一个catch(IOException localIOException2)内的localIOException2变成localIOException1的话 String str = paramIntent.getExtras().getString(DeviceListActivity.EXTRA_DEVICE_ADDRESS);又报错请指点

解决方案 »

  1.   

     Thread ReadThread = new Thread()
      {
        public void run()
        {
          byte[] arrayOfByte1 = new byte[1024];
          byte[] arrayOfByte2 = new byte[1024];
          BTClient.this.bRun = true;
          while (true)
          {
            int j;
            int k;
            try
            {
              if (BTClient.this.is.available() != 0)
              {
                int i = BTClient.this.is.read(arrayOfByte1);
                j = 0;
                String str1 = new String(arrayOfByte1, 0, i);
                BTClient localBTClient1 = BTClient.this;
                localBTClient1.fmsg += str1;
                k = 0;
                if (k < i)
                  continue;
                String str2 = new String(arrayOfByte2, 0, j);
                BTClient localBTClient2 = BTClient.this;
                localBTClient2.smsg += str2;
                if (BTClient.this.is.available() != 0)
                  continue;
                BTClient.this.handler.sendMessage(BTClient.this.handler.obtainMessage());
                continue;
                if ((arrayOfByte1[k] == 13) && (arrayOfByte1[(k + 1)] == 10))
                {
                  arrayOfByte2[j] = 10;
                  k++;
                }
                else
                {
                  arrayOfByte2[j] = arrayOfByte1[k];
                }
              }
              if (!BTClient.this.bRun)
                continue;
              continue;
            }
            catch (IOException localIOException)
            {
            }
            continue;
            j++;
            k++;
          }
        }
      };
    这里            if ((arrayOfByte1[k] == 13) && (arrayOfByte1[(k + 1)] == 10))
                {
                  arrayOfByte2[j] = 10;
                  k++;
                }
                else
                {
                  arrayOfByte2[j] = arrayOfByte1[k];
                }
    老是报错Unreachable code请解