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

  • Home
  • SEARCH
  • 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 4627398
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:33:44+00:00 2026-05-22T03:33:44+00:00

My java class file looks like public class SignIn extends Activity { /*** Called

  • 0

My java class file looks like

public class SignIn extends Activity {

/*** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
     setContentView(R.layout.signin);
}

/***Enter key event in phone********************************/
public boolean onKey(View v, int keyCode, KeyEvent event) {
    switch(keyCode) {
    case KeyEvent.KEYCODE_ENTER:
     Intent intent = new Intent(SignIn.this, List_Of_Songs.class);
     startActivity(intent);
            break;

    default:
            return false;
    }

    return true;
}

}

and xml

<?xml version="1.0" encoding="utf-8"?>

<TextView android:id="@+id/signinemailtxt"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:text="Email" android:textSize="20dp" android:layout_marginTop="65dp"
    android:layout_marginLeft="25dp" android:paddingRight="50dp" android:textColor="#000000"/>

<EditText android:id="@+id/signinemailid" android:hint="email@domain.com"
    android:layout_height="28dp" android:layout_width="170dp"
    android:layout_toRightOf="@+id/signinemailtxt"

     android:layout_marginTop="65dp"
    android:background="#ffffff" android:layout_below="@+id/signinlayout" />

<TextView android:id="@+id/signinpasswordtxt"
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:text="Password" android:textSize="20dp"
    android:layout_marginTop="20dp" android:layout_marginLeft="25dp"
    android:layout_below="@+id/signinemailtxt" android:paddingRight="15dp" android:textColor="#000000" />

<EditText android:id="@+id/signinpassword" android:hint="password"
    android:layout_height="28dp" android:layout_width="170dp"
    android:layout_toRightOf="@+id/signinpasswordtxt"
     android:layout_marginTop="20dp"
    android:background="#ffffff" android:layout_below="@+id/signinemailid" />

Now when i press enterkey in phone it doesnt go to the intent..the focus stays up with edittext passsword its self…what to do?

  • 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-22T03:33:44+00:00Added an answer on May 22, 2026 at 3:33 am

    Adding following lines in your java code:

    1) Create an object of your edit text:

    EditText editText = (EditText) findViewById(R.id.signinpassword);
    

    2) Add a onKeyListener to it:

    editText.setOnKeyListener(new OnKeyListener() {
    
                @Override
                public boolean onKey(View v, int keyCode, KeyEvent event) {
    
                    switch(keyCode) {
        case KeyEvent.KEYCODE_ENTER:
         Intent intent = new Intent(SignIn.this, List_Of_Songs.class);
         startActivity(intent);
                break;
    
        default:
                return false;
        }
    
        return true;
    
                }
            });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a file called Hello.java that looks like this: public class Hello {
scala.math.ScalaNumber is a Java file which looks like this: public abstract class ScalaNumber extends
I have a .java src file that looks like this: class Test { public
I have Servlet that looks something like this: public class MyServlet extends Servlet {
I've got a simple java class that looks something like this: public class Skin
I have a java class that looks like public class MyClass { private final
I have created simple Java class to test file writes from applets: update appeared
I have following class in Java code: public class CHRTreeCreator extends IndexCreator { ...
What are the consequences of running a Java class file compiled in JDK 1.4.2
I've got one really big .java class file that has a lot of members.

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.