Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8751753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:06:30+00:00 2026-06-13T13:06:30+00:00

I am using the following code to hide the keyboard when user presses enter:

  • 0

I am using the following code to hide the keyboard when user presses enter:

    friendSearch.setOnEditorActionListener(new OnEditorActionListener() {

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if(event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
                EditText friendSearch=(EditText) findViewById(R.id.friendsearch);
                InputMethodManager imm = (InputMethodManager)getSystemService(
                          Context.INPUT_METHOD_SERVICE);
                    imm.hideSoftInputFromWindow(friendSearch.getWindowToken(), 0);
                return true;
            }
            return false;
        }
    });

However, when I press the enter/next key(depending on device) on the keyboard, the app crashes. My error log cat is as follows:

10-31 12:27:00.092: E/ZygoteProcess(183): readInt++
10-31 12:27:00.109: E/Zygote(86): writeInt++17294
10-31 12:27:00.110: E/ZygoteProcess(183): readInt--: 17294
10-31 12:27:00.111: E/Zygote(86): writeInt--17294
10-31 12:27:07.700: E/AndroidRuntime(17280): FATAL EXCEPTION: main
10-31 12:27:07.700: E/AndroidRuntime(17280): java.lang.NullPointerException
10-31 12:27:07.700: E/AndroidRuntime(17280):    at com.olacabs.customer.activity.InviteFriendsFromContactsActivity$2.onEditorAction(InviteFriendsFromContactsActivity.java:134)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at android.widget.TextView.onEditorAction(TextView.java:3641)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at com.android.internal.widget.EditableInputConnection.performEditorAction(EditableInputConnection.java:114)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at com.android.internal.view.IInputConnectionWrapper.executeMessage(IInputConnectionWrapper.java:322)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at com.android.internal.view.IInputConnectionWrapper$MyHandler.handleMessage(IInputConnectionWrapper.java:106)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at android.os.Handler.dispatchMessage(Handler.java:130)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at android.os.Looper.loop(SourceFile:351)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at android.app.ActivityThread.main(ActivityThread.java:3814)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at java.lang.reflect.Method.invokeNative(Native Method)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at java.lang.reflect.Method.invoke(Method.java:538)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:901)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:659)
10-31 12:27:07.700: E/AndroidRuntime(17280):    at dalvik.system.NativeStart.main(Native Method)
10-31 12:27:10.607: E/IPCThreadState(183): IPCThread::waitForResponse checking error 3 : -32
10-31 12:27:10.607: E/JavaBinder(183): BpBinder::transact() returns exception, err is -32
10-31 12:27:10.607: E/IPCThreadState(183): IPCThread::waitForResponse checking error 3 : -32
10-31 12:27:10.607: E/JavaBinder(183): BpBinder::transact() returns exception, err is -32
10-31 12:27:10.612: E/InputDispatcher(183): channel '405b46b8 com.olacabs.customer/com.olacabs.customer.activity.MyAccountActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x8
10-31 12:27:10.612: E/InputDispatcher(183): channel '405b46b8 com.olacabs.customer/com.olacabs.customer.activity.MyAccountActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
10-31 12:27:10.663: E/Zygote(86): writeInt++17303
10-31 12:27:10.665: E/ZygoteProcess(183): readInt++
10-31 12:27:10.666: E/Zygote(86): writeInt--17303
10-31 12:27:10.667: E/ZygoteProcess(183): readInt--: 17303
10-31 12:27:11.121: E/JavaBinder(183): BpBinder::transact() returns exception, err is -32
10-31 12:27:11.121: E/JavaBinder(183): BpBinder::transact() returns exception, err is -32
10-31 12:27:11.125: E/IPCThreadState(370): IPCThread::waitForResponse checking error 3 : -32
10-31 12:27:11.125: E/JavaBinder(370): BpBinder::transact() returns exception, err is -32
10-31 12:27:11.927: E/Crittercism(17303): Initialize the Crittercism library before using its methods.

What am I doing wrong and how can I change this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T13:06:31+00:00Added an answer on June 13, 2026 at 1:06 pm

    Initialize editText before friendSearch.setOnEditorActionListener(new OnEditorActionListener() set Listener.

    EditText friendSearch=(EditText) findViewById(R.id.friendsearch);
    friendSearch.setOnEditorActionListener(new OnEditorActionListener() {
    
    @Override
    public boolean onEditorAction(TextView v, int keyCode,KeyEvent event) 
    {
         if ((event.getAction() == KeyEvent.ACTION_DOWN  ) &&  (keyCode == KeyEvent.KEYCODE_ENTER)   )
         {               
           // hide virtual keyboard
           InputMethodManager imm = (InputMethodManager)getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE);
           imm.hideSoftInputFromWindow(friendSearch.getWindowToken(), 0);
           return true;
        }
        return false;
    }});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code to show a spinning wheel: $(#loading) .hide() .ajaxStart(function(){ $(this).show();
I am creating date using following code try { newdatetime = new DateTime(2012, 2,
i am using following code. public class MyCount extends CountDownTimer { public MyCount(long millisInFuture,
I'm using the following code to hide a view and the space taken by
I'm using the following code to hide stderr on Linux/OSX for a Python library
I'm using the following code to hide a division on the page load: $(document).ready(function()
I am using the following code to hide and show a label in my
I'm using the following code to send push notifications to the user... document.triggerNotification =
I am trying to do the following using c# code: Hide some rows in
I am using the following code to show and hide two div positioned absolutely

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.