java.net.unknownhostException
1: 没有网络访问权限。
2:手机网络状态是:cmwap,要改成 cmnet模式。(别人有详细的说明:http://www.cnblogs.com/rockdean/articles/2439030.html )
2.判断一个字符串是不是以/n/r(/n:换行,/r:空格)结尾的
1:把字符串转换成byte数组。
2: 判断byte字符是不是等于/n和/r的acsii码值 /n: 13 /r :10
3: 华为C8812E背夹的条码返回值处理。(背夹返回值不是把条码的所有内容一次性返回,而是会多次返回值的操作)
ArrayList<Byte> tempList = new ArrayList<Byte>();
private final Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
byte[] bytes = (byte[]) msg.obj;
for (byte b : bytes) {
tempList.add(b);
}
strBuffer.append(new String(bytes));
mMailNumberTextView.setText(strBuffer.toString());
int byteLength = tempList.size();
if (byteLength >= 2) {
// 判断字节是不是 以 /n/r结尾
if ((tempList.get(byteLength - 1) == 13)
&& (tempList.get(byteLength - 2) == 10)) {
strBuffer = new StringBuilder();
tempList.clear();
}
}
break;
4: 华为C8812E拍照返回来的照片是压缩文件
设置输出的图片文件夹可以解决这个问题:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(
MediaStore.EXTRA_OUTPUT,
Uri.fromFile(new File(fileName))); //图片输出放到的目录
startActivityForResult(intent, CAMERA_RESULT_CODE);); //CAMERA_RESULT_CODE自定义的一个值