Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-7609] Android: Searchbar gets the focus when inside the tableview showing keyboard by default

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2013-01-17T15:47:00.000+0000
Affected Version/sRelease 1.8.0.1, Release 2.0.0, Release 1.8.2, Release 2.1.1
Fix Version/s2013 Sprint 02 API, 2013 Sprint 02
ComponentsAndroid
Labelsapi
ReporterNikhil Sharma
AssigneeHieu Pham
Created2012-02-09T21:50:13.000+0000
Updated2013-11-07T18:54:02.000+0000

Description

Description

When window opens, it immediately focuses to the searchbar inside tableview showing keyboard by default. This behavior is experienced in some devices only. I experienced it in Samsung Galaxy SII. The keyboard doesn't show up by default in Motorola DROID (old). This happens only in some devices,it runs perfectly in the emulator This is happening in Google Nexus Tablet 7 (with AndroidOS 4.1).

Repo Steps

1. Run the below code. 2. You can see the keyboard appears by default immediately when the window opens.
var win = Ti.UI.createWindow({backgroundColor: '#000000'});

var search = Titanium.UI.createSearchBar({
	barColor:'#000',
	showCancel:true,
	height:43,
	top:0
});

// create table view data object
var data = [
	{title:'Row 1', hasChild:true, color:'red', selectedColor:'#fff'},
	{title:'Row 2', hasDetail:true, color:'green', selectedColor:'#fff'},
	{title:'Row 3', hasCheck:true, color:'blue', selectedColor:'#fff'},
	{title:'Row 4', color:'orange', selectedColor:'#fff'},
	{title:'Row 5'},
	{title:'Row 6'},
	{title:'Row 7'},
	{title:'Row 8'},
	{title:'Row 9'},
	{title:'Row 10'},
	{title:'Row 11'},
];

// create table view
var tableview = Titanium.UI.createTableView({
	data:data,
	search:search 
});

// add table view to the window
win.add(tableview);

win.addEventListener('focus', function(e) {
	search.blur();
});

win.open();

Comments

  1. Jick Steen 2012-09-10

    Are there any known workarounds? Tried to find a workaround for days.
  2. Vishal Duggal 2012-12-04

    Focus and keyboard behavior are very device specific in the Android ecosystem.Have you tried setting windowSoftInputMode to hidden on the window? http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Window-property-windowSoftInputMode http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.Android-property-SOFT_INPUT_STATE_HIDDEN
  3. Anirudh Nagesh 2012-12-10

    Tested with 2.1.4.GA, latest 3.0CI and 3.1CI builds. The issue is reproducible. This is also seen in Nexus 7 tablet.
  4. Hieu Pham 2013-01-17

    Adding windowSoftInputMode: Ti.UI.Android.SOFT_INPUT_STATE_HIDDEN to the window seems to work for me.
  5. Anshu Mittal 2013-04-11

    Since the issue is device specific as mentioned in the comments, So, closing the issue.

JSON Source