[TIMOB-11627] Android: searchBar.focus() doesn't open the softKeyboard
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2012-11-02T22:19:21.000+0000 |
Affected Version/s | Release 2.1.3 |
Fix Version/s | 2012 Sprint 23 API, 2012 Sprint 23 |
Components | Android |
Labels | api |
Reporter | Nikhil Sharma |
Assignee | Hieu Pham |
Created | 2012-10-31T22:04:04.000+0000 |
Updated | 2014-06-19T12:44:09.000+0000 |
Description
searchBar.focus() doesn't open the softKeyboard. In the code below if you uncomment the code that adds a tableView the keyboard opens properly. This problem seems to happen with textField as well.
Repo Steps
1. Run the below code in your project's app.js. 2. Open the application. 3. The cursor shows up in the search bar but the keyboard never opens.
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({
backgroundColor : '#fff'
});
var dirView = Ti.UI.createView({
layout : 'vertical',
height : Ti.UI.FILL
});
var searchBar = Titanium.UI.createSearchBar({//problem also exists with TextField
width : Ti.UI.FILL,
height : 50,
softKeyboardOnFocus : Ti.UI.Android.SOFT_KEYBOARD_SHOW_ON_FOCUS
});
dirView.add(searchBar);
//the cursor shows up in the search bar but the keyboard never opens
searchBar.focus();
//uncommenting these lines 'fixes' the problem
// var thelist = Titanium.UI.createTableView();
// dirView.add(thelist);
win.add(dirView);
win.open();
The code that you posted to fix this issue doesn't work. I put it into the above app.js and the keyboard still doesn't open when I open the app.
Which build did you test this on? It works fine for me for 2.x, 3.x, and 4.x phones on master. This is the app.js I use:
I tested this on master and it seems to be fixed. Thanks
Tested with: SDK:3.1.1.v20130508233955 Appcelerator Studio: 3.1.1.201305072102 OS: OSX 10.7.5 Device: LG-p970(2.2.2), Android emulator(2.3.3) works as expected