zoukankan      html  css  js  c++  java
  • 二维码所有

    private TextView mTv_Ruslet;
    private EditText mInput;
    private ImageView mImg;
    private CheckBox isLogo;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mTv_Ruslet = (TextView) findViewById(R.id.tv_ruselt);
    mInput = (EditText) findViewById(R.id.et_text);
    mImg = (ImageView) findViewById(R.id.img);
    isLogo = (CheckBox) findViewById(R.id.is_logo);
    }
    //生成二维码
    public void make(View view){
    String input=mInput.getText().toString().trim();
    //生成二维码,然后为二维码增加logo
    Bitmap bitmap= EncodingUtils.createQRCode(input,500,500,isLogo.isChecked() ? BitmapFactory.decodeResource(getResources(),R.drawable.psb) : null
    );
    mImg.setImageBitmap(bitmap);
    }
    //扫描二维码
    public void scan(View view){
    startActivityForResult(new Intent(MainActivity.this, CaptureActivity.class), 0);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(resultCode==RESULT_OK){
    Bundle bundle=data.getExtras();
    String result=bundle.getString("result");
    mTv_Ruslet.setText(result);
    mInput.setText(result);
    }else if(resultCode==RESULT_CANCELED){
    mTv_Ruslet.setText("扫描出错");
    }
    }
  • 相关阅读:
    Beta冲刺(5/7)——2019.5.26
    Beta冲刺(4/7)——2019.5.25
    Beta冲刺(3/7)——2019.5.24
    Echo团队Beta冲刺随笔集合
    Echo团队Alpha冲刺随笔集合
    用户体验报告(Echo)
    Echo团队 对 待就业六人组 和 SkyReach 的Beta产品测试报告
    Beta冲刺第七天
    Beta冲刺第六天
    Beta冲刺第五天
  • 原文地址:https://www.cnblogs.com/zzwerzi/p/7638471.html
Copyright © 2011-2022 走看看