Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17244] Android: When using border-related attributes in Search View, the app crashes

GitHub Issuen/a
TypeBug
PriorityNone
StatusOpen
ResolutionUnresolved
Affected Version/sRelease 3.3.0
Fix Version/sn/a
ComponentsAndroid
Labelsreprod
ReporterDavid He
AssigneeUnknown
Created2014-06-02T01:52:00.000+0000
Updated2018-02-28T20:03:40.000+0000

Description

Problem Description

When using border-related attributes in Search View, the app crashes

Testcase

1. Create a new mobile project (classic titanium) 2. Add this code to the app.js
var win = Ti.UI.createWindow({});
var searchingView = Ti.UI.Android.createSearchView({
	borderColor : "#000000", //cause crash
	borderRadius : 5, //cause crash
	borderWidth : 1, //cause crash
	backgroundColor : "#E5E4E2",
	searchAsChild : true
});

var myTemplate = {
	childTemplates : [{
		type : 'Ti.UI.Label',
		bindId : "title",
		properties : {
			width : Ti.UI.SIZE,
			height : 44,
			left : 10,
			font : {
				fontFamily : "Arial",
				fontWeight : "normal",
				fontSize : 14
			},
			color : "#6d6e76"
		}
	}]
};

var listView = Ti.UI.createListView({
	top : 0,
	templates : {
		'template' : myTemplate
	},
	defaultItemTemplate : 'template',
	separatorInsets : {
		left : 0,
		right : 0
	},
	backgroundColor : "#FFFFFF",
	separatorColor : "#848482",
	searchView : searchingView
});
var sections = [];

var fruitSection = Ti.UI.createListSection();
var fruitDataSet = [{
	properties : {
		"searchableText" : "Row One",
	},
	title : {
		"text" : "Row One"
	}
}];
fruitSection.setItems(fruitDataSet);
sections.push(fruitSection);

listView.setSections(sections);

win.setBackgroundColor("e2e2e2");

win.add(listView);
win.open();

Expected Result

Set border properties for searchView

Actual Result

Crash the app

Extra info

 TiApplication: (main) [152,890] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.negoapps.searchcrash/org.appcelerator.titanium.TiTranslucentActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.; Titanium 3.3.0,2014/05/24 22:42,baea217
[ERROR] :  TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.negoapps.searchcrash/org.appcelerator.titanium.TiTranslucentActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
[ERROR] : 

Comments

  1. Mauro Parra-Miranda 2014-06-30

    Thanks for your report. The priority will be set by the Platform team.
  2. jithinpv 2014-08-27

    Issue reproduces Titanium SDK version 3.4.0 master, 3.3.0.GA Titanium Studio, build: 3.3.0.201407100905 Titanium Command-Line Interface CLI version 3.3.0, Android device : Samsung Galaxy S3, Android version : 4.3
  3. Dan Tamas 2015-01-21

    This is still an issue with 3.5.0 Alloy code:
       		<TableView id="contactTable">
       
       	  		<SearchBar platform="ios" class="contactSearch"/>
       	  		<SearchView ns="Ti.UI.Android" platform="android" class="contactSearch"/>
       
                   <TableViewSection id="letterA" headerTitle="A" class="rowTitle">
       
    tss:
       '.contactSearch':{
       	borderColor:Alloy.CFG.theme.colors.breadcrumbs_bg,
       }
       
    If I remove the borderColor in tss it doesn't crash anymore.
  4. Lee Morris 2017-06-27

    I am able to reproduce this issue with the following environment; Pixel (7.1) Ti SDK 6.1.1.v20170626160851 Appc NPM 4.2.9 Appc CLI 6.2.2 Ti CLI 5.0.14 Alloy 1.9.11 Xcode 8.2 (8C38) Node v4.8.2 Java 1.8.0_131

JSON Source