mirror of https://github.com/axmolengine/axmol.git
closed #5188, fixed android NULL pointer exception
This commit is contained in:
parent
67f809e223
commit
fc8d286fcb
|
@ -123,6 +123,7 @@ public class Cocos2dxTextInputWraper implements TextWatcher, OnEditorActionListe
|
|||
public boolean onEditorAction(final TextView pTextView, final int pActionID, final KeyEvent pKeyEvent) {
|
||||
if (this.mCocos2dxGLSurfaceView.getCocos2dxEditText() == pTextView && this.isFullScreenEdit()) {
|
||||
// user press the action button, delete all old text and insert new text
|
||||
if (null != mOriginText) {
|
||||
for (int i = this.mOriginText.length(); i > 0; i--) {
|
||||
this.mCocos2dxGLSurfaceView.deleteBackward();
|
||||
/*
|
||||
|
@ -131,16 +132,20 @@ public class Cocos2dxTextInputWraper implements TextWatcher, OnEditorActionListe
|
|||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
String text = pTextView.getText().toString();
|
||||
|
||||
if (text != null) {
|
||||
/* If user input nothing, translate "\n" to engine. */
|
||||
if (text.compareTo("") == 0) {
|
||||
if ( text.compareTo("") == 0) {
|
||||
text = "\n";
|
||||
}
|
||||
|
||||
if ('\n' != text.charAt(text.length() - 1)) {
|
||||
if ( '\n' != text.charAt(text.length() - 1)) {
|
||||
text += '\n';
|
||||
}
|
||||
}
|
||||
|
||||
final String insertText = text;
|
||||
this.mCocos2dxGLSurfaceView.insertText(insertText);
|
||||
|
|
Loading…
Reference in New Issue