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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:01:09+00:00 2026-05-25T14:01:09+00:00

I have a game that uses a callback to Java from C++ to force

  • 0

I have a game that uses a callback to Java from C++ to force open the soft keyboard when the user touches the screen. The Java code is simply this:

this._inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);

This has worked fine for a while but recently we’ve been receiving complaints from some Motorola Droid users that the soft keyboard fails to open for them. Since we’ve only recently started to get these complaints and it’s a number of users I’m thinking it was some kind of update to those devices.

Is there a better way I can force the keyboard to open? All the links I find online talk about using textbox controls and such but my app is primarily C++ and doesn’t use the standard controls at all.

  • 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-25T14:01:10+00:00Added an answer on May 25, 2026 at 2:01 pm

    I don’t know if this is related to your problem, but I was running into some issues using only InputMethodManager.toggleSoftInput() when devices would sometimes get “out of sync” and hide when I wanted to show and vice versa.

    I’ve had some success by taking advantage of the fact that while IMM.showSoftInput() won’t show a keyboard, IMM.hideSoftInputFromWindow() will reliably close one, so when I want to show a keyboard I now call IMM.hideSoftInputFromWindow() followed by IMM.toggleSoftInput(), and use IMM.hideSoftInputFromWindow() by itself to hide one.

    [A day later…]

    Writing the above yesterday made me rethink how I was dealing with the soft keyboard (I mean, showSoftinput() does work, just not the way we expected it to) and so here is a better way to do it:

    First, you need to set up your view so that Android knows it can have a soft keyboard – described in the docs for InputMethodManager. In my case I have a single view derived from GLSurfaceView and so I added:

    setFocusable(true);
    setFocusableInTouchMode(true);
    

    to the constructor and then the following 2 overrides:

    @Override
    public InputConnection onCreateInputConnection(EditorInfo outAttrs)
    {
        outAttrs.actionLabel = "";
        outAttrs.hintText = "";
        outAttrs.initialCapsMode = 0;
        outAttrs.initialSelEnd = outAttrs.initialSelStart = -1;
        outAttrs.label = "";
        outAttrs.imeOptions = EditorInfo.IME_ACTION_DONE | EditorInfo.IME_FLAG_NO_EXTRACT_UI;        
        outAttrs.inputType = InputType.TYPE_NULL;        
    
        return  new BaseInputConnection(this, false);       
    }     
    
    @Override
    public boolean onCheckIsTextEditor ()
    {
        return true;
    }
    

    Now I can show the keyboard with:

    InputMethodManager mgr = (InputMethodManager)mActivity.getSystemService(Context.INPUT_METHOD_SERVICE); 
    mgr.showSoftInput(mView, 0);
    

    and the keypresses get reported via the view’s onKeyUp() and onKeyDown() methods.

    Hiding it is still done using hideSoftInputFromWindow()

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

Sidebar

Related Questions

i have a java game app that uses sockets to communicate with each other.
I have written a game that uses GLUT, OpenGL and FMOD. The problem is
I have a game that uses layers as a way to organize depth. It
I have a game engine that uses OpenGL for display. I coded a small
I'm creating a game that uses cards. I have an AppController class with one
I'm developing a card game that uses rummy-style sets of three cards. From a
ok well i have a simple game that uses really high of memory and
Please forgive the newbie question. I have an iphone game that currently uses lots
I'm wrapping up development on an iPhone game right now that uses data from
I am working on an application that uses the Game Center feature from iOS

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.