Write data from a barcode?

0

I'm trying to develop an app to read CT-e archiving so I need to write the data read in the barcode, I'm using the ZXing library, but the recipient is textview .

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        switch (requestCode) {
            case IntentIntegrator.REQUEST_CODE:
                IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode,
                        resultCode, data);
                if (scanResult == null) {
                    return;
                }
                final String result = scanResult.getContents();
                if (result != null) {
                    handler.post(new Runnable() {
                        @Override
                        public void run() {
                           txtScanResult.setText(result);

                        }
                    });
                }
                break;
            default:

How do I get a EditText to receive and save data?

Thanks in advance for the help.

    
asked by anonymous 08.07.2015 / 23:00

1 answer

0

Good morning! Home It is interesting that you ask a question for each question: To receive and display in an EditText, follow the excerpt:

    public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {
        if (resultCode == Activity.RESULT_OK) {

            /* este é seu código! */
            String contents = intent.getStringExtra("SCAN_RESULT");
            /*Aqui seu EditText recebe o código*/
            txtScanResult.setText(contents);
        }
    }
}
    
09.07.2015 / 16:49