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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:16:58+00:00 2026-05-18T11:16:58+00:00

I have a simple Activity that uses a android:theme=@android:style/Theme.Dialog in the manifest. My activity

  • 0

I have a simple Activity that uses a android:theme="@android:style/Theme.Dialog" in the manifest.

My activity consists of an EditText, 2 Buttons, and a TextView. It is nothing more than a box for the user to enter in a name and press OK/Cancel.

I just want to focus the EditText and have the soft keyboard automatically show when the Activity is started. I’ve read countless posts about this but I just can’t seem to get it to work. When the activity starts the blinking cursor appears in the EditText, but the keyboard won’t show until I click inside it.

Here is my Activity:

public class Finalize extends Activity {

    private EditText mEditName;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.finalize_dialog);

        mEditName = (EditText) findViewById(R.id.file_name_edit);
        mEditName.setFocusable(true);
        mEditName.requestFocus();

        mEditName.setOnFocusChangeListener(new View.OnFocusChangeListener() {           
            @Override
            public void onFocusChange(View v, boolean hasFocus) {
                getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
            }
        });
    }
}

I’ve also tried this in onCreate:

    InputMethodManager mgr = (InputMethodManager) getSystemService(this.INPUT_METHOD_SERVICE);
    mgr.showSoftInput(mEditName, 0);

Edit: My manifest for reference

    <activity class=".Finalize"
        android:name=".Finalize"
        android:label="@string/file_name_title"
        android:theme="@android:style/Theme.Dialog"
        android:screenOrientation="portrait"        
        android:windowSoftInputMode="stateAlwaysVisible">
    </activity>
  • 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-18T11:16:59+00:00Added an answer on May 18, 2026 at 11:16 am

    The following should work. Go to your manifest and update your activity line with the android:windowSoftInputMode attribute.

    <activity android:name=".Finalize"
        android:windowSoftInputMode="stateAlwaysVisible">
        ...
    </activity>
    

    See the following documentation page for more details on the different parameters that can be passed into this attribute.

    I tested the above and it works fine for me. Here is my terribly simple example.
    Code:

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

    Layout:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <TextView 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" 
          android:text="@string/hello"    />
        <EditText android:id="@+id/edit_text_test"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"/>
    </LinearLayout>
    

    Manifest:

        <activity android:name=".DialogActivity"
                  android:windowSoftInputMode="stateAlwaysVisible"
                  android:label="@string/app_name"
                  android:theme="@android:style/Theme.Dialog">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple game that consists of only one activity, and I
I have a simple HelloWorld Activity that I try to test with an Android
I have a simple WebView-based activity that follows the Hello, WebView example to enable
I have a simple UIViewController that uses a XIB for its interface. As such,
I have a Android application that requires a splash screen. I have a simple
Hopefully this is very simple. I have a central activity that can be launched
Should simple JavaBeans that have only simple getters and setters be unit tested?? What
I have a simple webform that will allow unauthenticated users to input their information,
I have a simple 2-column layout with a footer that clears both the right
I have an activity that has properties that look something like this (they're set

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.