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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:20:16+00:00 2026-05-28T08:20:16+00:00

First, I don’t know what’s the key code for the Return key or Backspace

  • 0

First, I don’t know what’s the key code for the Return key or Backspace the one that has a line on the Android keyboard.

Secondly I have multiple edittext fields on the screen and I want each one to resign the keyboard when the user hit that Return key.

    imm= (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);

   public void onClick(View v) {
     int flag;
     flag=v.getId();
     // keycode for return
     if(v.getId()==XX) {
         imm.hideSoftInputFromWindow(YYY.getWindowToken(), 0);

     }

XX is the keycode for that Return key and YYY is what I should fill in. I would like YYY generic that’s applying to all the edittext fields in the program

  • 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-05-28T08:20:17+00:00Added an answer on May 28, 2026 at 8:20 am

    I’m not sure why you are trying to handle this in an onClick method. The right way, I think, is to call setOnKeyListener() for each EditText view and in your OnKeyListener, you can do this:

    public boolean onKey(View v, int keyCode, KeyEvent event) {
        if (keyCode = KeyEvent.KEYCODE_ENTER) {
            // non-null only for enter key
            imm.hideSoftInputFromWindow(v.getWindowToken(), 0);
            return true;
        }
        return false;
    }
    

    A single instance of OnKeyListener can be used for all EditText views (any view at all, actually) where you want this behavior.

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

Sidebar

Related Questions

I've got a table and it's looking alike that: First I don't know how
First of all I don't know if this is the right approach. I want
First off I should say that I don't have any experience in working with
First of all, I don't want to use a join because that will make
I don't understand why atoi() is working for every entry but the first one.
i newbie this my first project,I don't know how to resolve any problems about
My Table has two sections and at the first section I don't have elements
First I don't know the term of Proxy Methods are true way to describe
I have two tables, I need all rows from the first that don't appear
First off I don't know much about regex and need to buy a book

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.