'Xamarin Android - Get the result of a Scan Honeywell
I am deploying an app for a android scanner Honeywell. I guess that the internal scanner act like a keyboard because if I do the following, it works :
AppCompatEditText input = FindViewById<AppCompatEditText>(Resource.Id.input);
AppCompatTextView output = FindViewById<AppCompatTextView>(Resource.Id.output);
input.TextChanged += (object sender, Android.Text.TextChangedEventArgs e) => {
output.Text = e.Text.ToString();
};
( The Barcode is displayed in the TextView )
However, I'd like not to use a input EditText but track any scan performed without having to give focus to a field.
I have tried the following :
public override bool OnKeyUp(Keycode keyCode, KeyEvent e)
{
Console.WriteLine(e.ToString()); // Or whatever property of object e
return base.OnKeyUp(keyCode, e);
}
Unfortunately it looks like KeyEvent or Keycode class will not give the data but the code of the press key. Therefore I have a result like "190" ( Code of the key ) or "RIGHT_BUTTON" ( name of the key )..
Anybody who could give me a lead ???
Thanks a lot !
Pierre.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
