相关疑难解决方法(0)

在活动开始之前触发了Android onActivityResult!

我有一个应用程序需要扫描条形码才能获得代码才能继续.

我使用此代码开始扫描活动:

finish = (Button) findViewById(R.id.finishButton);
        finish.setOnClickListener(new OnClickListener() {
            public void onClick(View viewParam) {

                /*Prompt the user to scan the barcode */
                new AlertDialog.Builder(Visit.this)
                .setMessage("Please Scan the clients barcode to complete the visit")
                .setPositiveButton("Scan Barcode", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        //Start the scan application
                        Intent intent = new Intent("com.google.zxing.client.android.SCAN");
                        startActivityForResult(intent, 0);
                    }
                })

                .setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which) {
                        //Execute some method call
                        Toast.makeText(Visit.this, "Scan declined...", Toast.LENGTH_SHORT).show();
                    } …
Run Code Online (Sandbox Code Playgroud)

android barcode-scanner android-activity onactivityresult

4
推荐指数
1
解决办法
5327
查看次数