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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T06:19:39+00:00 2026-05-20T06:19:39+00:00

My activity implements KeyListener and my edittext has a key listener set. editor =

  • 0

My activity implements KeyListener and my edittext has a key listener set.

editor = new EditText(this);
        editor.setMinLines(4);
        editor.setMinimumWidth(400);
        editor.setKeyListener(this);

WHen the user types something and presses “enter” on the softkeyboard a textview’s text is set to the users input.

@Override
public int getInputType() {

    return InputType.TYPE_TEXT_FLAG_MULTI_LINE;
}


@Override
public boolean onKeyDown(View view, Editable text, int keyCode,
        KeyEvent event) {
    if(keyCode == KeyEvent.KEYCODE_ENTER){

        outview.setText(editor.getText());
    }
    return true;
}

Here outview is a TextView. My problem is that in this activity the physical back button doesn’t work. Press it and nothing happens. ANy advice would be welcomed.

  • 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-20T06:19:40+00:00Added an answer on May 20, 2026 at 6:19 am

    By returning true from the onKeyDown function, you are informing Android that you have handled all key events. Instead, only return true in the case of the enter key. Return false otherwise. This will allow Android to handle the back button key press.

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

Sidebar

Related Questions

i have public class ExperimentAllInOneActivity extends Activity implements OnClickListener on each button click listener
I have this code: public class VoiceActivity extends Activity implements OnClickListener { private TextView
this is my Manual.java file: public class Manual extends Activity implements OnClickListener{ Button create;
I impleme public class TextViewer extends Activity implements OnTouchListener and tv.setOnLongClickListener(itemLongClickHandler); tv.setOnTouchListener(this); But I
In Android I am seeing code like this: public class Now extends Activity implements
public class TestCamera extends Activity implements SurfaceHolder.Callback, View.OnClickListener { ... Camera.PictureCallback mPictureCallback = new
So i have this code: public class StreamingMp3Player extends Activity implements OnClickListener, OnTouchListener, OnCompletionListener,
So I have my MainDisplayActivity which implements both Activity and LoaderManager.LoaderCallbacks<Cursor> . Here I
This activity is used for login. It post the username and password to a
public class BabyName extends Activity implements View.OnClickListener, Runnable{ /** Called when the activity is

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.