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 8730299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:59:34+00:00 2026-06-13T08:59:34+00:00

I am using the following code to make the virtual keyboard disappear after the

  • 0

I am using the following code to make the virtual keyboard disappear after the user presses enter on it:

nameText.setOnEditorActionListener(new OnEditorActionListener() {

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

However, when I press enter, the app crashes. What is wrong with the code

The error log cat is as follows:

10-23 12:37:15.507: E/AndroidRuntime(2969): FATAL EXCEPTION: main
10-23 12:37:15.507: E/AndroidRuntime(2969): java.lang.ClassCastException: com.olacabs.customer.model.TextViewPlus cannot be cast to android.widget.EditText
10-23 12:37:15.507: E/AndroidRuntime(2969):     at com.olacabs.customer.activity.MyProfileActivity$3.onEditorAction(MyProfileActivity.java:173)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.widget.TextView.doKeyDown(TextView.java:5611)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.widget.TextView.onKeyDown(TextView.java:5503)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.KeyEvent.dispatch(KeyEvent.java:2668)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.View.dispatchKeyEvent(View.java:5527)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1266)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1266)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1266)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1266)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1266)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1266)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1266)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:1928)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at com.android.internal.policy.impl.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1388)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.app.Activity.dispatchKeyEvent(Activity.java:2388)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:1855)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.ViewRootImpl.deliverKeyEventPostIme(ViewRootImpl.java:3604)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2848)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.os.Handler.dispatchMessage(Handler.java:99)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.os.Looper.loop(Looper.java:154)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at android.app.ActivityThread.main(ActivityThread.java:4974)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at java.lang.reflect.Method.invokeNative(Native Method)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at java.lang.reflect.Method.invoke(Method.java:511)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
10-23 12:37:15.507: E/AndroidRuntime(2969):     at dalvik.system.NativeStart.main(Native Method)
10-23 12:37:15.527: E/EmbeddedLogger(1613): App crashed! Process: com.olacabs.customer
10-23 12:37:15.527: E/EmbeddedLogger(1613): App crashed! Package: com.olacabs.customer v2001 (2.0.0.1)
10-23 12:37:15.527: E/EmbeddedLogger(1613): Application Label: Ola Cabs
10-23 12:37:17.399: E/InputDispatcher(1613): channel '40e86a78 com.olacabs.customer/com.olacabs.customer.activity.PickUpActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
10-23 12:37:17.419: E/InputDispatcher(1613): channel '416bd7f8 com.olacabs.customer/com.olacabs.customer.activity.MyProfileActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
10-23 12:37:17.429: E/InputDispatcher(1613): channel '418c7898 PopupWindow:4105d7e8 (server)' ~ Channel is unrecoverably broken and will be disposed!
10-23 12:37:17.429: E/InputDispatcher(1613): channel '41c40030 com.olacabs.customer/com.olacabs.customer.activity.MyAccountActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
10-23 12:37:17.579: E/ActivityManager(1613): fail to set top app changed! (2)
10-23 12:37:17.579: E/ActivityManager(1613): java.lang.NullPointerException
10-23 12:37:17.579: E/ActivityManager(1613):    at com.android.server.am.ActivityManagerService.handleTopAppChanged(ActivityManagerService.java:15869)
10-23 12:37:17.579: E/ActivityManager(1613):    at com.android.server.am.ActivityManagerService.updateOomAdjLocked(ActivityManagerService.java:15319)
10-23 12:37:17.579: E/ActivityManager(1613):    at com.android.server.am.ActivityManagerService.updateLruProcessInternalLocked(ActivityManagerService.java:1942)
10-23 12:37:17.579: E/ActivityManager(1613):    at com.android.server.am.ActivityManagerService.updateLruProcessLocked(ActivityManagerService.java:1949)
10-23 12:37:17.579: E/ActivityManager(1613):    at com.android.server.am.ActivityStack.realStartActivityLocked(ActivityStack.java:626)
10-23 12:37:17.579: E/ActivityManager(1613):    at com.android.server.am.ActivityManagerService.attachApplicationLocked(ActivityManagerService.java:4285)
10-23 12:37:17.579: E/ActivityManager(1613):    at com.android.server.am.ActivityManagerService.attachApplication(ActivityManagerService.java:4373)
10-23 12:37:17.579: E/ActivityManager(1613):    at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:347)
10-23 12:37:17.579: E/ActivityManager(1613):    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1714)
10-23 12:37:17.579: E/ActivityManager(1613):    at android.os.Binder.execTransact(Binder.java:338)
10-23 12:37:17.579: E/ActivityManager(1613):    at dalvik.system.NativeStart.run(Native Method)
10-23 12:37:18.169: E/MapActivity(3867): Couldn't get connection factory client
  • 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-13T08:59:35+00:00Added an answer on June 13, 2026 at 8:59 am

    So you get the
    java.lang.ClassCastException: com.olacabs.customer.model.TextViewPlus cannot be cast to android.widget.EditText
    .

    This means that EditText nameText=(EditText) findViewById(R.id.nameText); is wrong.

    What findViewById(R.id.nameText) returns is not a EditText, but is a TextViewPlus instance.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently facing new problem with operators. Using following code, I want to make
I'm using the following code to make my treenodes bold: Font font = new
I am using the following code to make a HttpWebRequest and render the XML
I am using the following code to get make an IMAP connection. I am
I'm using the following code to just make a single UILabel on my cell.
I'm using the following code to try to make a back button for my
I am trying to compile my gcc code using the following make command .
I am creating date using following code try { newdatetime = new DateTime(2012, 2,
I am using the following code to make shortcuts in Delphi. I want to
I am using following code to make a phone call from my iPhone app:

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.