Próbuję ustawić własną wartość na imeActionId
, a następnie porównując to samo z actionId
w onEditorAction
. Ale actionId
w metodzie wielokrotnie zwraca 0.Jak korzystać z wartości ImeactionId
<EditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="text|textUri"
android:imeOptions="actionGo"
android:imeActionId="666"
android:imeActionLabel="google"/>
I Oto mój onEditorAction
:
et.setOnEditorActionListener(new OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
// TODO Auto-generated method stub
Log.v("myid iss", "" + actionId);
if(actionId == 666)
{
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("http://" + v.getText().toString()));
imm.hideSoftInputFromInputMethod(v.getWindowToken(), InputMethodManager.HIDE_IMPLICIT_ONLY);
startActivity(i);
}
return false;
}
});
The actionId
zbliża się 0 za każdym razem, niezależnie od wartości w pliku XML. Jak używać zdefiniowanego imeActionId
do porównania z actionId
.
Czy znalazłeś jakieś rozwiązanie? – Hamid