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.










share|improve this question























  • 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














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.










share|improve this question























  • 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












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.










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 21:15

























asked Nov 11 at 18:37









Sifaks Agizul

2316




2316











  • 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
















  • 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















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

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















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






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線