IReadListener Interface |
Namespace: Com.Datalogic.Decode
The IReadListener type exposes the following members.
Name | Description | |
---|---|---|
Dispose | Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable.) | |
OnRead | onRead method will be called when a good read event is fired. |
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();
}
}