I have a barcode device that can be connected to a computer or to an android device through USB port. It scans the barcode and show the result wherever it finds a cursor, it can be an editbox, notepad, browser or whatever. What I want to do is to get data in a variable as soon it scans the barcode without showing it on the edittext.
Your scanner is functionally equivalent to a keyboard, so you can't scan the data directly into a variable.
However, as @MH. suggested, you can watch a text input field and grab the data once it's entered. You might be able to programmaticly set the focus on the hidden field when the user clicks a button. If that doesn't work you might be able to style the input so the user can't see the scanned data (eg make the text color the same as the background color)