I have a bug where keyboard input does not work on a few Android devices. The text input seems to either be wrong, not work at all or only work with a few characters.
Some players have been able to fix the issue by changing the keyboard layout to QWERTY and disabling auto-spelling, but this only works for some.
On iOS and most Android devices the keyboard input works perfectly, and I have not been able to reproduce the problem on my Galaxy S3 or Galaxy Tab 10.1.
I am using CCTextFieldTTF and this is my code for when a character is entered:
bool CCTextInputNode::onTextFieldInsertText(CCTextFieldTTF * pSender, const char * text, int nLen)
// if insert enter, treat as default to detach with ime
if ('\n' == *text)
std::string allowed = allowedChars_;
std::string::size_type find = allowed.find(text);
if (find == std::string::npos) return true;
// if the textfield's char count more than m_nCharLimit, doesn't insert text anymore.
if (pSender->getCharCount() >= charLimit_ && charLimit_ > 0) return true;
allowedChars_ is an std::string which contains all valid characters, such as " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".
Does anyone have an idea on what the problem could be or how to fix it? Appreciate the help