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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:18:14+00:00 2026-06-11T23:18:14+00:00

In an Activity say MainActivity , i have programatically added a Fragment say Fragment_1

  • 0

In an Activity say MainActivity, i have programatically added a Fragment say Fragment_1

This Fragment_1 has a layout which contains an EditText. When i start showing this Fragment_1, the EditText gets focused but the soft keyboard is not openned

So i click on the EditText to open the keyboard, type some text and click done button, which must replace Fragment_1 with Fragment_2 which also contains an EditText.

But this EditText in Fragment_2 is not focused, but the keyboard is still open (may be because of the last Fragment_1)

so i added this for Fragment_2

EditText.requestFocus();

the focus is there and the keyboard is open, but the EditText is not getting populated by the Key Characters i am clicking.

Why is it so??

Thank You.

  • 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-11T23:18:15+00:00Added an answer on June 11, 2026 at 11:18 pm

    You should hide keyboard for first edit text on first fragment

    private InputMethodManager mInputMethodManager = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
    EditText.clearFocus();
    mInputMethodManager.hideSoftInputFromWindow(EditText.getWindowToken(), 0);
    

    and than you should request focus and show keyboard for second edit text:

    EditText.requestFocus();
    mInputMethodManager.showSoftInput(EditText, 0);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say we have a standard MainActivity that extends Activity . It contains onCreate
I have a MainActivity the default start up Activity which creates a TCP worker
Say I'm on my main activity and I start a new activity MainActivity >
Say if I have a locationManager(LM) object in activity A, which is my main
I have an app that contains several activities...so lets say user is navigating activity
I have an activity(say, MyActivity) that contains fragments, and i am using fragmentTransaction.replace(XX,YY) for
So, lets say in my main activity, i have an array declared like this,
I have 2 activities - Say Activity A and B. My main activity(A) has
I have developed some reusable android component which is basically a class . This
I am using Webview in an Android activity (say Activity B ) like this

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.