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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:19:52+00:00 2026-05-22T17:19:52+00:00

I would like the keyboard to open when my Activity starts. I’ve tried all

  • 0

I would like the keyboard to open when my Activity starts. I’ve tried all the methods/answers with the questions below with no luck.

I believe the issue is when the hardware keyboard is available, the default behavior is for the soft keyboard to not be displayed. Can this be overridden? What happens if the hardware keyboard is hidden?

I’ve read the following questions with no luck. The closest to the problem I’m experiencing is here:
Question 2712822

Others Include:
Question 3379403
Question 2479504

Main.xml:

<?xml version="1.0" encoding="utf-8"?>
  <ScrollView android:id="@+id/scrollView1" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android">
    <LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:layout_height="match_parent" android:orientation="vertical">
         <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout2" android:layout_gravity="center" android:layout_width="match_parent">
            <TextView android:layout_height="wrap_content" android:text="TextView" android:layout_width="wrap_content" android:id="@+id/textView1"></TextView>
            <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/testText" android:focusable="true" android:focusableInTouchMode="true" android:hint="Input here"></EditText>
        </LinearLayout>
        <LinearLayout android:layout_height="match_parent" android:id="@+id/linearLayout2" android:layout_gravity="center" android:layout_width="match_parent">
            <TextView android:layout_height="wrap_content" android:text="TextView" android:layout_width="wrap_content" android:id="@+id/textView1"></TextView>
            <EditText android:id="@+id/editText1" android:layout_height="wrap_content" android:layout_width="fill_parent" android:hint="and here"></EditText>
        </LinearLayout>  
    </LinearLayout>
 </ScrollView>

My Main Activity code looks like this:

package com.example.example3;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;

public class example3 extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    EditText edit = (EditText)this.findViewById(R.id.testText);
    edit.requestFocus();

    /*       // Below Doesn't work
    InputMethodManager imm = (InputMethodManager)
    example3.this.getSystemService(Context.INPUT_METHOD_SERVICE);

    if (imm != null){/          imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
    }

    //Below Doesn't work
   // getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    */    
    }
}

Is this a lost cause? Can someone test this on a phone with hardware keyboard that is closed and tell me what happens?

  • 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-22T17:19:53+00:00Added an answer on May 22, 2026 at 5:19 pm

    The softinputMode related answers should be working. If you’re having no luck with setting it in the manifest you might try setting it in onCreate() to dictate how the keyboard is shown when navigating to the activity.

    To show it anytime the activity gets focus use:

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to open the soft keyboard on when the Activity starts and
How do I set my application to record keyboard macros. Like Shift-Alt-I would open
I would like to write a program which can monitor activity of my keyboard.
I would like to have the keyboard already displaying when I show my view.
I work on a synthesizer where I would like to have a keyboard/piano displayed
I would like three menu items on the menubar with the keyboard shortcuts cmd-1,
I would like to play around with some ideas and develop a soft keyboard
I would like to build my own virtual keyboard for my windows 7 tablet.
In emacs, I would like to rebind the top row of my keyboard [1...0]
I would like to have a keyboard like this in my application: How to

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.