com.datalogic.decode.ReadListener |
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();
}
}
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
onRead method will be called when a good read event is fired.
|
onRead method will be called when a good read event is fired.
decodeResult | The data read as defined by DecodeResult |
---|