修改二维码生成例子界面布局、修复扫描二维码界面崩溃bug

This commit is contained in:
zengfantian 2015-01-20 17:59:47 +08:00
parent 74a7062e71
commit f95fcab1d1
2 changed files with 13 additions and 1 deletions

View File

@ -61,6 +61,8 @@ public class ZxingGenBinActivity extends BaseActivity {
return ;
}
getOperation().showLoading("正在生成...");
//回收bitmap
if(null != qrImage && !qrImage.isRecycled()){
qrImage.recycle();
@ -73,6 +75,9 @@ public class ZxingGenBinActivity extends BaseActivity {
//生成图片
String filePath = ToolFile.gainSDCardPath() + "/MyLive/QRImage/"+UUID.randomUUID().toString()+".jpg";
ToolFile.saveAsJPEG(qrImage, filePath);
getOperation().closeLoading();
ToolAlert.showShort("二维码已经保存在:"+filePath);
} catch (Exception e) {
@ -86,6 +91,9 @@ public class ZxingGenBinActivity extends BaseActivity {
public void onClick(View v) {
try {
getOperation().showLoading("正在生成...");
//回收bitmap
if(null != validateCodeImage && !validateCodeImage.isRecycled()){
validateCodeImage.recycle();
@ -98,6 +106,8 @@ public class ZxingGenBinActivity extends BaseActivity {
ToolAlert.showShort("验证码值:"+ToolPicture.gainValidateCodeValue());
getOperation().closeLoading();
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.view.View;
import com.zftlive.android.R;
import com.zftlive.android.base.BaseActivity;
import com.zftlive.android.zxing.CaptureActivity;
@ -17,7 +18,7 @@ public class ZxingSacnnerActivity extends BaseActivity {
@Override
public int bindLayout() {
return 0;
return R.layout.activity_zxing_scanner;
}
@Override
@ -29,6 +30,7 @@ public class ZxingSacnnerActivity extends BaseActivity {
public void doBusiness(Context mContext) {
Intent intent = new Intent(this,CaptureActivity.class);
startActivity(intent);
finish();
}
@Override