扫描QRcode时如何打开新活动?

时间:2018-02-20 14:17:48

标签: android qr-code

如何在扫描QRcode后打开新活动,其中每个QRcode都有一个活动。这是我的代码

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        IntentResult result = IntentIntegrator.parseActivityResult(requestCode, resultCode, data);

        if(result != null){
            if(result.getContents() == null){
                Toast.makeText(this, "sambel sere", Toast.LENGTH_LONG).show();
            }
            else if(resultCode == RESULT_OK) {
                String contents = data.getStringExtra("SCAN_RESULT");
                Intent inten = new Intent(ReaderActivity.this, sambel.class);
                startActivity(inten);
                Toast.makeText(this, result.getContents(), Toast.LENGTH_LONG).show();
            }
        }
        else {
            super.onActivityResult(requestCode, resultCode, data);
        }

0 个答案:

没有答案