这个是二维码第三方库 private void createQRImage(String utl) { // TODO Auto-generated method stub try { // String contentString = qrStrEditText.getText().toString(); // if (!contentString.equals("")) { if(utl ==null && utl.length()>1 && "".equals(utl) ){ return ; } Bitmap qrCodeBitmap = EncodingHandler.createQRCode(utl, 600); ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { FileOutputStream fos = new FileOutputStream(new File(Environment.getExternalStorageDirectory(), System.currentTimeMillis()+".jpg")); qrCodeBitmap.compress(Bitmap.CompressFormat.PNG, 100, bos); textview.setImageBitmap(qrCodeBitmap); fos.write(bos.toByteArray()); fos.flush(); fos.close(); Toast.makeText(BarCodeActivity.this, "生成成功", 0).show(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // }else { // Toast.makeText(BarCodeActivity.this, "生成不成功,请稍后.......", Toast.LENGTH_SHORT).show(); // } } catch (WriterException e) { // TODO Auto-generated catch block e.printStackTrace(); } } 里面的一些代码
- 粉丝: 0
- 资源: 1
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助