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

The Archive Base Latest Questions

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

have now tried using this code but keep getting a null value when I

  • 0

have now tried using this code but keep getting a null value when I hit enter? Can anyone suggest a solution to avoid this?

editext.setOnKeyListener(new View.OnKeyListener() {         
   public boolean onKey (View v, int keyCode, KeyEvent event) {             
      // TODO Auto-generated method stub             
      if (keyCode==KeyEvent.KEYCODE_ENTER) {                  
         if ("test1".equalsIgnoreCase(editext.getText().toString())) {                    
            but4.performClick();                     
         }
      }                 
      else if ("test2".equalsIgnoreCase(editext.getText().toString())) {            
         but5.performClick();                 
      }              

      if ("test5".equalsIgnoreCase(editext.getText().toString())) {              
         but6.performClick();             
      }              

      if ("test7".equalsIgnoreCase(editext.getText().toString())) {              
         but7.performClick();             
      }             

      if (editext.getText().toString() != null){               
         testwrong.seText("wrong");               
      }          

      return true;             
   }
}); 
  • 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-13T02:23:34+00:00Added an answer on June 13, 2026 at 2:23 am

    According to the documentation, the keyCode value corresponds to the hardware key pressed. This probably does not refer to the soft keyboard.

    Try to get the value of the keyboard key pressed from the KeyEvent.

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

Sidebar

Related Questions

I tried endlessly now you resolve this utter frustrating situation I have been having.
I have tried for three days now and gotten nowhere on this.... I absolutely
I have tried for a very long time now to figure out, why this
I have tried to download images to a directory but now I want to
Im trying to display this listview, but I keep getting a: 07-17 21:14:22.233: ERROR/AndroidRuntime(349):
This seems something I shouldnt have to waste a question on, but I can't
I have a data with the following format: foo<tab>1.00<space>1.33<space>2.00<tab>3 Now I tried to sort
In a previous question: Getting "This method or property cannot be called on Null
I have a catch-all route setup in ASP.NET MVC, so I can capture /this-page,
OK, so I have two (completely unrelated, different project) classes using iterators now. One

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.