setOnEditorActionListener is not returning anything
up vote
0
down vote
favorite
It took me awhile to figure out this setOnEditorActionListener is the culprit. At least around that area.
Running the test on a real device won't trigger anything when enter is pressed.
Same thing with the emulator, but it works fine using Enter on my computer keyboard.
I have added some lines to my .xml file that was suggested from users here.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
View view = inflater.inflate(R.layout.fragment_search, container, false);
mFilters = (ImageView) view.findViewById(R.id.ic_search);
mSearchText = (EditText) view.findViewById(R.id.input_search);
Log.d(TAG, "getElasticSearchPassword: retrieving elasticsearch aissa password."+ mElasticSearchPassword);
getElasticSearchPassword();
init();
return view;
private void init()
mSearchText.setOnEditorActionListener(new
TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
);
Here is my original XML file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/search_toolbar"
android:background="@drawable/grey_border_bottom"
android:padding="2dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:hint="search..."
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textSize="14sp"
android:layout_toLeftOf="@+id/ic_search"
android:id="@+id/input_search"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:imeOptions="actionSearch"
android:inputType="text"
/>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/ic_search"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_search"
android:layout_marginRight="5dp"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recyclerView"
android:scrollbars="vertical"
android:layout_below="@+id/search_toolbar"
android:background="@color/lightGrey">
</android.support.v7.widget.RecyclerView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/container"
android:visibility="gone">
</FrameLayout>
</RelativeLayout>
Also I tried to remove the if condition. Suspecting that some API don't respond to IME_ACTION.
android android-studio android-fragments android-softkeyboard
add a comment |
up vote
0
down vote
favorite
It took me awhile to figure out this setOnEditorActionListener is the culprit. At least around that area.
Running the test on a real device won't trigger anything when enter is pressed.
Same thing with the emulator, but it works fine using Enter on my computer keyboard.
I have added some lines to my .xml file that was suggested from users here.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
View view = inflater.inflate(R.layout.fragment_search, container, false);
mFilters = (ImageView) view.findViewById(R.id.ic_search);
mSearchText = (EditText) view.findViewById(R.id.input_search);
Log.d(TAG, "getElasticSearchPassword: retrieving elasticsearch aissa password."+ mElasticSearchPassword);
getElasticSearchPassword();
init();
return view;
private void init()
mSearchText.setOnEditorActionListener(new
TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
);
Here is my original XML file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/search_toolbar"
android:background="@drawable/grey_border_bottom"
android:padding="2dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:hint="search..."
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textSize="14sp"
android:layout_toLeftOf="@+id/ic_search"
android:id="@+id/input_search"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:imeOptions="actionSearch"
android:inputType="text"
/>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/ic_search"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_search"
android:layout_marginRight="5dp"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recyclerView"
android:scrollbars="vertical"
android:layout_below="@+id/search_toolbar"
android:background="@color/lightGrey">
</android.support.v7.widget.RecyclerView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/container"
android:visibility="gone">
</FrameLayout>
</RelativeLayout>
Also I tried to remove the if condition. Suspecting that some API don't respond to IME_ACTION.
android android-studio android-fragments android-softkeyboard
EditText is AndroidManifest.XML? Please sharelayout.fragment_search
xml file.
– Faysal Ahmed
Nov 11 at 18:46
Possible duplicate of setOnEditorActionListener not working with soft keyboard submit button, but does with laptop Enter key?
– Faysal Ahmed
Nov 11 at 18:49
@FaysalAhmed you can see that I have added that solution to my xml, but the issue is still there
– Sifaks Agizul
Nov 11 at 20:14
I have tried this and its working fine.
– Faysal Ahmed
Nov 12 at 5:02
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
It took me awhile to figure out this setOnEditorActionListener is the culprit. At least around that area.
Running the test on a real device won't trigger anything when enter is pressed.
Same thing with the emulator, but it works fine using Enter on my computer keyboard.
I have added some lines to my .xml file that was suggested from users here.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
View view = inflater.inflate(R.layout.fragment_search, container, false);
mFilters = (ImageView) view.findViewById(R.id.ic_search);
mSearchText = (EditText) view.findViewById(R.id.input_search);
Log.d(TAG, "getElasticSearchPassword: retrieving elasticsearch aissa password."+ mElasticSearchPassword);
getElasticSearchPassword();
init();
return view;
private void init()
mSearchText.setOnEditorActionListener(new
TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
);
Here is my original XML file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/search_toolbar"
android:background="@drawable/grey_border_bottom"
android:padding="2dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:hint="search..."
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textSize="14sp"
android:layout_toLeftOf="@+id/ic_search"
android:id="@+id/input_search"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:imeOptions="actionSearch"
android:inputType="text"
/>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/ic_search"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_search"
android:layout_marginRight="5dp"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recyclerView"
android:scrollbars="vertical"
android:layout_below="@+id/search_toolbar"
android:background="@color/lightGrey">
</android.support.v7.widget.RecyclerView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/container"
android:visibility="gone">
</FrameLayout>
</RelativeLayout>
Also I tried to remove the if condition. Suspecting that some API don't respond to IME_ACTION.
android android-studio android-fragments android-softkeyboard
It took me awhile to figure out this setOnEditorActionListener is the culprit. At least around that area.
Running the test on a real device won't trigger anything when enter is pressed.
Same thing with the emulator, but it works fine using Enter on my computer keyboard.
I have added some lines to my .xml file that was suggested from users here.
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState)
View view = inflater.inflate(R.layout.fragment_search, container, false);
mFilters = (ImageView) view.findViewById(R.id.ic_search);
mSearchText = (EditText) view.findViewById(R.id.input_search);
Log.d(TAG, "getElasticSearchPassword: retrieving elasticsearch aissa password."+ mElasticSearchPassword);
getElasticSearchPassword();
init();
return view;
private void init()
mSearchText.setOnEditorActionListener(new
TextView.OnEditorActionListener()
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
);
Here is my original XML file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.v7.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="50dp"
android:id="@+id/search_toolbar"
android:background="@drawable/grey_border_bottom"
android:padding="2dp"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null"
android:hint="search..."
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textSize="14sp"
android:layout_toLeftOf="@+id/ic_search"
android:id="@+id/input_search"
android:layout_gravity="center_vertical"
android:maxLines="1"
android:imeOptions="actionSearch"
android:inputType="text"
/>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/ic_search"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="@drawable/ic_search"
android:layout_marginRight="5dp"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/recyclerView"
android:scrollbars="vertical"
android:layout_below="@+id/search_toolbar"
android:background="@color/lightGrey">
</android.support.v7.widget.RecyclerView>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/container"
android:visibility="gone">
</FrameLayout>
</RelativeLayout>
Also I tried to remove the if condition. Suspecting that some API don't respond to IME_ACTION.
android android-studio android-fragments android-softkeyboard
android android-studio android-fragments android-softkeyboard
edited Nov 11 at 21:15
asked Nov 11 at 18:37
Sifaks Agizul
2316
2316
EditText is AndroidManifest.XML? Please sharelayout.fragment_search
xml file.
– Faysal Ahmed
Nov 11 at 18:46
Possible duplicate of setOnEditorActionListener not working with soft keyboard submit button, but does with laptop Enter key?
– Faysal Ahmed
Nov 11 at 18:49
@FaysalAhmed you can see that I have added that solution to my xml, but the issue is still there
– Sifaks Agizul
Nov 11 at 20:14
I have tried this and its working fine.
– Faysal Ahmed
Nov 12 at 5:02
add a comment |
EditText is AndroidManifest.XML? Please sharelayout.fragment_search
xml file.
– Faysal Ahmed
Nov 11 at 18:46
Possible duplicate of setOnEditorActionListener not working with soft keyboard submit button, but does with laptop Enter key?
– Faysal Ahmed
Nov 11 at 18:49
@FaysalAhmed you can see that I have added that solution to my xml, but the issue is still there
– Sifaks Agizul
Nov 11 at 20:14
I have tried this and its working fine.
– Faysal Ahmed
Nov 12 at 5:02
EditText is AndroidManifest.XML? Please share
layout.fragment_search
xml file.– Faysal Ahmed
Nov 11 at 18:46
EditText is AndroidManifest.XML? Please share
layout.fragment_search
xml file.– Faysal Ahmed
Nov 11 at 18:46
Possible duplicate of setOnEditorActionListener not working with soft keyboard submit button, but does with laptop Enter key?
– Faysal Ahmed
Nov 11 at 18:49
Possible duplicate of setOnEditorActionListener not working with soft keyboard submit button, but does with laptop Enter key?
– Faysal Ahmed
Nov 11 at 18:49
@FaysalAhmed you can see that I have added that solution to my xml, but the issue is still there
– Sifaks Agizul
Nov 11 at 20:14
@FaysalAhmed you can see that I have added that solution to my xml, but the issue is still there
– Sifaks Agizul
Nov 11 at 20:14
I have tried this and its working fine.
– Faysal Ahmed
Nov 12 at 5:02
I have tried this and its working fine.
– Faysal Ahmed
Nov 12 at 5:02
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251926%2fsetoneditoractionlistener-is-not-returning-anything%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
EditText is AndroidManifest.XML? Please share
layout.fragment_search
xml file.– Faysal Ahmed
Nov 11 at 18:46
Possible duplicate of setOnEditorActionListener not working with soft keyboard submit button, but does with laptop Enter key?
– Faysal Ahmed
Nov 11 at 18:49
@FaysalAhmed you can see that I have added that solution to my xml, but the issue is still there
– Sifaks Agizul
Nov 11 at 20:14
I have tried this and its working fine.
– Faysal Ahmed
Nov 12 at 5:02