title: Android Edittext keypress does not fire
body: <p>I am trying to get Enter key whenever user pressed.</p>
  
  <p>I tried many codes but neither in emulator nor in device I could get the Enter keypress.</p>
  
  <p>Here is my code : </p>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements View.OnKeyListener {
  String barkodsifre;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      EditText sifre = (EditText) findViewById(R.id.barkodsifre);
      sifre.setOnKeyListener(this);
  }
  public boolean onKey(View v, int keyCode, KeyEvent event) {
      if ((event.getAction() == KeyEvent.ACTION_DOWN) &amp;&amp;
              (keyCode == KeyEvent.KEYCODE_ENTER)) {
          Log.i("a","b");
          return true;
      }
      return false;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>There is only 1 edittext and a textview in xml. Data will be entered to edittext by a barcode scanner. Barcode scanner will send "Enter" at the end of the scanned barcode. 
  I send 'enter' from barcode scanner at the end of the barcode but somehow it never handles enter key.</p>
  
  <p>Is something missed in code or the code is totaly wrong? How can I handle "enter" key which comes from a barcode scanner.</p>
  
  <p>Here is my xml :</p>
  
  <pre><code> &lt;RelativeLayout
      android:layout_width="368dp"
      android:layout_height="495dp"
      tools:layout_editor_absoluteX="8dp"
      tools:layout_editor_absoluteY="8dp"&gt;
  
      &lt;TextView
          android:id="@+id/lblbarkod"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
          android:ems="10"
          android:inputType="none"
          android:text="Barkod Giriniz!"
          android:textAlignment="center"
          android:textSize="30sp"
          android:textStyle="bold" /&gt;
  
      &lt;EditText
          android:id="@+id/barkodsifre"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignEnd="@+id/lblbarkod"
          android:layout_alignLeft="@+id/lblbarkod"
          android:layout_alignRight="@+id/lblbarkod"
          android:layout_alignStart="@+id/lblbarkod"
          android:layout_below="@+id/lblbarkod"
          android:imeOptions="actionGo|flagNoFullscreen"
          android:inputType="textPassword"
          android:maxLines="1"
          android:ems="10" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>