soft keyboard display on android

soft keyboard display on android
0.0 0


I have an issue with displaying sof keyboard on android devices.
I use CCTextFieldTTF to set user name (on player death event in my game) I do this as simple as it can be:

pNicknameDelegate = new CCTextFieldDelegate();
CCTextFieldTTF* pNickname = CCTextFieldTTF::textFieldWithPlaceHolder("Enter Player Nickname", (pConfig->getResourceName(RES_FONT_FOLKSOLID))->toStdString().c_str(), 20.0f);
    CCSize s = CCDirector::sharedDirector()->getWinSize();
    pNickname->setPosition(ccp(pResultsTable->getContentSize().width*0.15f, pResultsTable->getContentSize().height*0.69+1.0f*mScale));
    pNickname->setAnchorPoint(ccp(0.0, 0.5));

then in some place in code i simply call:


and now:

  • on iOS devices (iPhone, iPad) soft keyboard became visible and I can type user name;
  • on Android devices soft keyboard not became visible and I can’t type user name.

Why my keyboard is not showing when I call attachWithIME() on Android devices ? Can you help me in that issue ? Am I doing something wrong ?


I am sorry about it.
The implementation of CCTextField is not so good on Android.
And #1375 has been created for it.

If you have any resolution for it, please help us.
Thank you.


I solved my problem. I removed somehow (don’t know when) TextView from my main layout xml file.
and in Cocos2dxGLSurfaceView handler checked

if (null != mTextField && mTextField.requestFocus()) {

where my code flow was stopped, because mTextField was null.
Damn Android manifests, layouts and other dependent xml’s…
Now it works fine :slight_smile:



is there any other reason why the keyboard does not show for CCTextFieldTTF for Android. I am facing similar problem as well. At first, the keyboard shows. But after some integration with Facebook, it does not show any more.

Anyone has any idea why this is so?