Write data from a Barcode?

Asked

Viewed 139 times

0

I’m trying to develop an app for reading CT-archiving and for that I need to record the data read in the barcode, I’m using the Zxing library ,but who receives is a 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 to make that a EditText receive and record data?

Thanks in advance for the help.

  • 1

    Do you know how to write the data? Will it be written to Sharedpreferences , or sqlite? Give more details about what you have, and what you want to do, so you can make it easier for us to help! Greetings!

1 answer

0


Good morning!
It is interesting that I realize a question for every 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);
        }
    }
}
  • Good evening , clarifying the question: I already receive the data in a Textview what I want is to be passed or received by an Edittext to so write it in a BD.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.