public interface ReadListener
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.
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();
}
}
BarcodeManager| Modifier and Type | Method and Description |
|---|---|
void |
onRead(DecodeResult decodeResult)
onRead method will be called when a good read event is fired.
|
void onRead(DecodeResult decodeResult)
decodeResult - The data read as defined by DecodeResultDecodeResult