解决方案 »
- C向JAVA多个字符串传递问题
- super.setResult(RESULT_OK, intent);如果intent数据太多,界面会黑屏反映很慢,有什么其他解决方案么?
- [Android] 怎样移除android 短信(SMS) notification?
- 哪位大虾帮帮忙哦
- 软件怎么自动升级
- 安装在android系统上的程序,如何抓他的包
- 关于spinner的setOnItemLongClickListener
- 关于数据库存储图片的,求助
- okhttp3,如何把文件和值为int类型键值对,一起提交。
- sqlite如何实现判断具体某行某列的字段是否为空?
- 求移动web,手机网页,html5网站的源码下载网址(注意是手机上看的网,不是电脑看的)
- 如将将onDraw()方法中的canvas保存到bitmap中?
byte[] buff = new byte[1024];
int bytes = -1;
while(true){
try {
bytes = inputStream.read(buff);
if(bytes != -1){
byte[] buf_data = new byte[bytes];
for(int i=0; i<bytes; i++){
buf_data[i] = buff[i];
}
msg = new String(buf_data);
testResultDetails.message = msg;
}
else{
String msg = "no data receive restart you phone";
Log.i("data", msg);
testResultDetails.message = msg;
}
} catch (IOException e) {
Log.e("app", "失去连接");
e.printStackTrace();
}
}
}
byte[] buff = new byte[1024];
int bytes = -1;
while(true){
try {
Log.i("State", "开始接受数据ClientReceiveData");
bytes = inputStream.read(buff);
if(bytes != -1){
Log.i("bytes", bytes+"BBBBBBBBBBBBB");
byte[] buf_data = new byte[bytes];
for(int i=0; i<bytes; i++){
buf_data[i] = buff[i];
}
msg += new String(buf_data);
msg = msg.trim();
flag ++;
Log.i("data", "MMMMMMMMM"+msg);
if(("[").equals((String)msg.subSequence(0,1)) && ("]").equals(msg.substring(msg.length()-1))){
Log.i("data", msg);
testResultDetails.message = msg;
msg = "";
flag = 0;
}
if(flag == 2){
msg = "";
flag = 0;
}
}
else{
Log.i("bytes", "CCCCCCCCCCC");
String msg = "no data receive restart you phone";
Log.i("data", msg);
testResultDetails.message = msg;
}
} catch (IOException e) {
// TODO 自动生成的 catch 块
Log.e("app", "失去连接");
e.printStackTrace();
}
}
}