to top
Datalogic APIs
Added in revision 1
public interface

ReadListener

com.datalogic.decode.ReadListener

Class Overview

This interface is used by the application to listen to the decoder's read event. This is intended to be used with the addReadListener method of the BarcodeManager class. More than one object instance can listen to the decoding events in an application. More than one application can listen to decoding events in the system.

Code snippet for Android:

import com.datalogic.decode.*;
// import also other packages needed to compile your app

public class MainActivity extends Activity {

     

      BarcodeManager decoder = null;

      TextView mBarcodeText;

 

      @Override

      protected void onCreate(Bundle savedInstanceState) {

            super.onCreate(savedInstanceState);

            setContentView(R.layout.activity_main);

            mBarcodeText = (TextView)findViewById(R.id.editText1);

            try {

                  if (decoder==null) {

                        decoder = new BarcodeManager();

                        decoder.addReadListener(new ReadListener() {

                                   @Override

                                   public void onRead(DecodeResult decodeResult) {

                                        

                                         mBarcodeText.setText(decodeResult.getText());

                                   }

                                  

                             };

                        );

                  }

                 

            } catch (DecodeException e) {

                 

                  e.printStackTrace();

            }

 

      }

 

      @Override

      protected void onDestroy() {

            super.onDestroy();

                                decoder.release();

      }

}

See Also

Summary

Public Methods
abstract void onRead(DecodeResult decodeResult)
onRead method will be called when a good read event is fired.

Public Methods

public abstract void onRead (DecodeResult decodeResult)

Added in revision 1

onRead method will be called when a good read event is fired.

Parameters
decodeResult The data read as defined by DecodeResult
See Also