android - controlling IME show search action instead of enter
<p>Hi I'm trying to override IME action to show search on virtual keyboard. My <code>EditText</code> is in the control that is placed onto the activity.</p>

<p>Here is what I have:</p>

<pre><code>&lt;EditText android:id="@+id/txtSearch"
    android:textSize="18dp"
    android:textColor="@color/main_text_black"
    android:layout_width="247dp" 
    android:layout_height="fill_parent"
    android:imeOptions="actionSearch"
    android:gravity="center_vertical"
    android:singleLine="true"
    android:background="@null"
    android:layout_alignParentLeft="true"
    android:layout_marginLeft="38px" /&gt;
</code></pre>

<p>In Code I have this listener set on the <code>EditText</code>: </p>

<pre><code>@Override
public boolean onEditorAction(TextView view, int arg1, KeyEvent arg2) {
    if((arg1 == EditorInfo.IME_ACTION_SEARCH) {
        for(OnSearchListener listener : _listeners) {
            listener.OnSearch(view, getSearchString());
        }
    }
    InputMethodManager imm = 
        (InputMethodManager)_context.getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(view.getWindowToken(), 0);

    return false;
}
</code></pre>

<p><code>arg1</code> always comes back as <code>0</code> when I press the enter key, which is "unidentified". I also tried different keyboards like sendMessage and none of them work neither. What's going on?</p>

<p>Thank you in advance! </p>
