Click or drag to resize

IReadListener Interface

public class MainActivity extends Activity {

Namespace:  Com.Datalogic.Decode
Assembly:  datalogic-xamarin-sdk (in datalogic-xamarin-sdk.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
public interface IReadListener : IJavaObject, 
	IDisposable, IJavaPeerable

The IReadListener type exposes the following members.

Methods
  NameDescription
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from IDisposable.)
Public methodOnRead
onRead method will be called when a good read event is fired.
Top
Remarks
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();

      }

}

[Android Documentation]

See Also