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);又报错请指点
{
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);又报错请指点
解决方案 »
- 求助:android webview加载网页,对网页中资源(如图片、css等)重定向问题
- 程序中如何动态关掉某个actvity
- 写了一个Activity之间跳转的程序,但是跳转时出错,谁帮忙看看吧~小女子感激不尽。
- 如何在Activity的子线程内调用startActivity()打开另一Activity?
- 这是什么问题啊!!!
- android 里可以用哪些填充GridView 的视图
- HTC Hero 使用的是什么版本的Android系统?
- 关于android获取root权限?
- ps遮罩效果怎么实现在android里实现
- 求助,android项目出现这么个错误
- FFmpegFrameRecorder录制视频不能设置视频帧率
- 如何实现多个Fragment 切换不刷新数据,保留当前状态?
{
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请解