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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:57:55+00:00 2026-05-26T11:57:55+00:00

i have an activity with four edittext and i want to hide keyboard when

  • 0

i have an activity with four edittext and i want to hide keyboard when users finish to use one of the four edittext. if i click enter on keyboard, it will focus another edittext and keyboard still remain, but i need to hide keyboard, so to use only one edittext and not necessarily the other.
This is xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent" android:background="@drawable/sfondo">
<LinearLayout android:id="@+id/linearLayout1"
    android:layout_width="match_parent" android:layout_height="wrap_content">
    <ImageButton android:id="@+id/backPersonalizza"
        android:src="@drawable/back" android:background="@null"
        android:layout_marginTop="10dip" android:layout_width="wrap_content"
        android:layout_height="wrap_content" android:layout_marginLeft="5dp"></ImageButton>
    <TextView android:layout_height="wrap_content"
        android:gravity="center"
        android:textColor="@android:color/black" android:id="@+id/testoSuggerimenti"
        android:text="Personalizza il testo e le icone. Clicca su una delle icone e scegli l'immagine preferita"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:layout_width="wrap_content"
        android:layout_marginTop="10dp"
        android:layout_marginRight="5dp"
        ></TextView>
</LinearLayout>
<LinearLayout android:id="@+id/linearLayout2"
    android:layout_height="wrap_content" android:layout_width="match_parent"
    android:orientation="vertical" android:layout_marginTop="20dp">
    <LinearLayout android:id="@+id/linearLayout3"
        android:layout_height="wrap_content" android:layout_width="match_parent">
        <EditText android:layout_height="40dp" android:id="@+id/editT1"
            android:layout_width="115dp" android:layout_marginLeft="32dp"
            android:layout_marginRight="25dp" android:gravity="center"
            android:ellipsize="end" android:singleLine="true">
            <requestFocus></requestFocus>
        </EditText>
        <EditText android:layout_height="40dp" android:id="@+id/editT2"
            android:layout_width="115dp" android:layout_marginRight="10dp"
            android:gravity="center" android:ellipsize="end"
            android:layout_marginLeft="10dp" android:singleLine="true"></EditText>
    </LinearLayout>
    <LinearLayout android:layout_weight="1" android:id="@+id/linearLayout4"
        android:layout_height="match_parent" android:layout_width="wrap_content">
        <ImageButton android:layout_height="wrap_content"
            android:layout_width="wrap_content" android:src="@drawable/tasto1"
            android:id="@+id/tastoMod1" android:background="@null"
            android:layout_marginLeft="30dp" android:layout_marginTop="-5dp"></ImageButton>
        <ImageButton android:layout_height="wrap_content"
            android:layout_width="wrap_content" android:src="@drawable/tasto2"
            android:id="@+id/tastoMod2" android:background="@null"
            android:layout_marginLeft="30dp" android:layout_marginTop="-5dp"></ImageButton>
    </LinearLayout>
</LinearLayout>
<LinearLayout android:id="@+id/linearLayout5"
    android:layout_height="wrap_content" android:layout_width="match_parent"
    android:orientation="vertical">
    <LinearLayout android:id="@+id/linearLayout6"
        android:layout_height="wrap_content" android:layout_width="match_parent">
        <EditText android:layout_height="40dp" android:id="@+id/editT3"
            android:layout_width="115dp" android:layout_marginLeft="32dp"
            android:layout_marginRight="25dp" android:gravity="center"
            android:ellipsize="end" android:singleLine="true"></EditText>
        <EditText android:layout_height="40dp" android:id="@+id/editT4"
            android:layout_width="115dp" android:layout_marginRight="30dp"
            android:gravity="center" android:ellipsize="end" android:singleLine="true"
            android:layout_marginLeft="10dp"></EditText>
    </LinearLayout>
    <LinearLayout android:id="@+id/linearLayout7"
        android:layout_height="wrap_content" android:layout_width="match_parent">
        <ImageButton android:layout_height="wrap_content"
            android:layout_width="wrap_content" android:src="@drawable/tasto3"
            android:id="@+id/tastoMod3" android:background="@null"
            android:layout_marginLeft="30dp" android:layout_marginTop="-5dp"></ImageButton>
        <ImageButton android:layout_height="wrap_content"
            android:layout_width="wrap_content" android:src="@drawable/tasto4"
            android:id="@+id/tastoMod4" android:background="@null"
            android:layout_marginLeft="30dp" android:layout_marginTop="-5dp"></ImageButton>
    </LinearLayout>
</LinearLayout>

can you help me?

  • 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-26T11:57:56+00:00Added an answer on May 26, 2026 at 11:57 am

    I am not sure but you should try this code:-

    youredittext.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    
        @Override
        public boolean onEditorAction(TextView v, int keyCode, KeyEvent event) {
            if ((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                // hide virtual keyboard
                InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.hideSoftInputFromWindow(youredittext.getWindowToken(), 0);
                return true;
            }
            return false;
        }
    });
    

    I hope this will help..

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

Sidebar

Related Questions

i have main activity in which i have Four menus. and i have one
I have activity A in package one, and I want to run an intent
in my app i use relative layout for design.in an activity i have four
I have one activity Select which has four buttons and other activity Result. Now
Background: I have an Activity that comprises four buttons that each take up a
in my app i have activity with XML layout, i want to build an
I have an activity with a custom view which extends EditText in it. Usually
I am a begginer in android,here I have activity that use web service: SoapObject
I am a beginner in android. I have four stages (four activities). In activity
I have four wheels which spin with the numbers 0-9: I want to be

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.