Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (keyboard)
Viewing all articles
Browse latest Browse all 352

Android: Soft Keyboard not showing on textfield focus on Galaxy Nexus 4.2.2

$
0
0

Hi, recently a client complained about not being able to input values on our app on her Galaxy Nexus. I was a bit astonished but then I tested it using an AVD configured as Galaxy Nexus SDK 4.2.2 and found out she was right.

It's very easy to reproduce this, create a Hello World app using the classical template and use the below code on your app.js file. Run it against:

  • AVD device Galaxy Nexus SDK 4.2.2: soft keyboard never shows
  • AVD device Nexus 5 SDK 5: soft keyboard shows up when pressing a textfield (as expected)

Can somebody else reproduce the same results? Am I missing something obvious? Many thanks

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
 
//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({  
    title:'Tab 1',
    backgroundColor:'#fff'
});
 
// Create a TextField.
var aTextField = Ti.UI.createTextField({
    height : 35,
    top : 10,
    left : 40,
    width : 240,
    hintText : 'This is hint text 1',
    softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS, // Android only
    keyboardType : Ti.UI.KEYBOARD_DEFAULT,
    returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
    borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED
});
 
// Listen for return events.
aTextField.addEventListener('return', function(e) {
    aTextField.blur();
    alert('Input was: ' + aTextField.value);
});
 
 
// Create a TextField.
var aTextField2 = Ti.UI.createTextField({
  height : 35,
  top : 60,
  left : 40,
  width : 240,
  hintText : 'This is hint text 2',
  softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_DEFAULT_ON_FOCUS, // Android only
  keyboardType : Ti.UI.KEYBOARD_DEFAULT,
  returnKeyType : Ti.UI.RETURNKEY_DEFAULT,
  // borderStyle : Ti.UI.INPUT_BORDERSTYLE_ROUNDED // just to be sure it's not caused by TIMOB-9574
});
 
// Listen for return events.
aTextField2.addEventListener('return', function(e) {
  aTextField2.blur();
  alert('Input was: ' + aTextField2.value);
});
 
 
// Add to the parent view.
win1.add(aTextField);
win1.add(aTextField2);
 
// open window
win1.open();
All this was tested with Titanium 3.5.0 GA.

Viewing all articles
Browse latest Browse all 352

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>