[TIMOB-17482] Android: App crashes when using searchBar border properties
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-10-15T03:32:42.000+0000 |
Affected Version/s | Release 3.2.3, Release 3.3.0 |
Fix Version/s | Release 4.0.0 |
Components | Android |
Labels | qe-testadded |
Reporter | Motiur Rahman |
Assignee | Hieu Pham |
Created | 2014-08-11T09:12:07.000+0000 |
Updated | 2015-01-27T17:21:36.000+0000 |
Description
App crashes if we use the searchBar properties borderRadius, borderColor, or borderWidth. And use this searchBar in a tableView using search property.
Testing Environment:
Titanium SDK: 3.3.0.GA, 3.2.3.GA Titanium CLI: 3.3.0, Android SDK: 4.2.2, 4.4.2 OS X Version: 10.9.3, Appcelerator Studio: 3.3.0Steps to Reproduce the issue:
1. Create classic project. 2. Paste this code app.js file. 3. Run this code with the testing environment.Test Code
var win = Titanium.UI.createWindow({
title : "search bar"
});
// create table view data object
var data = [];
data[0] = Ti.UI.createTableViewRow({
hasChild : true,
title : 'Row 1'
});
data[1] = Ti.UI.createTableViewRow({
hasDetail : true,
title : 'Row 2'
});
data[2] = Ti.UI.createTableViewRow({
hasCheck : true,
title : 'Row 3'
});
data[3] = Ti.UI.createTableViewRow({
title : 'Row 4'
});
var search = Titanium.UI.createSearchBar({
borderRadius : 10,
borderColor : 'red',
borderWidth : 2,
showCancel : true,
height : 60,
hintText : "Filter results",
});
// create table view
var tableview = Titanium.UI.createTableView({
data : data,
top : 40,
search : search,
filterAttribute : "title",
});
win.add(tableview);
win.open();
[ERROR] : TiApplication: (main) [107,107] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bd.apptest1/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.; Titanium 3.2.3,2014/04/22 10:17,b958a70
[ERROR] : TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.bd.apptest1/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
[ERROR] : TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
[ERROR] : TiApplication: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
[ERROR] : TiApplication: at android.app.ActivityThread.access$600(ActivityThread.java:141)
[ERROR] : TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
[ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:99)
[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:137)
[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5041)
[ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:511)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
[ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method)
[ERROR] : TiApplication: Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
[ERROR] : TiApplication: at android.view.ViewGroup.addViewInner(ViewGroup.java:3339)
[ERROR] : TiApplication: at android.view.ViewGroup.addView(ViewGroup.java:3210)
[ERROR] : TiApplication: at android.view.ViewGroup.addView(ViewGroup.java:3186)
[ERROR] : TiApplication: at ti.modules.titanium.ui.widget.TiUITableView.processProperties(TiUITableView.java:155)
[ERROR] : TiApplication: at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1185)
[ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:480)
[ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:471)
[ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:449)
[ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:487)
[ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:471)
[ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:449)
[ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:566)
[ERROR] : TiApplication: at org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.java:544)
[ERROR] : TiApplication: at ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:303)
[ERROR] : TiApplication: at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:32)
[ERROR] : TiApplication: at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:452)
[ERROR] : TiApplication: at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:528)
[ERROR] : TiApplication: at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
[ERROR] : TiApplication: at android.app.Activity.performCreate(Activity.java:5104)
[ERROR] : TiApplication: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
[ERROR] : TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
[ERROR] : TiApplication: ... 11 more
Thanks
Issue reproduces Titanium Command-Line Interface CLI version 3.3.0, Titanium SDK version 3.4.0 master, 3.3.0.GA, 3.2.3.GA Android device : Motorola Moto G, Android version : 4.4.4
Having the exact same issue. No way to style the search bar :(
master PR: https://github.com/appcelerator/titanium_mobile/pull/6212
Verified fix on: Mac OSX 10.10.1 Appcelerator Studio, build: 3.4.1.201410281743 Titanium SDK build: 3.6.0.v20150126105739 Titanium CLI, build: 3.4.1 Alloy: 1.5.1 Android build tools: 21.1.1 Nexus 6 (5.0.1), Nexus 4 (4.4.4) Using the provided code built to both devices. The app no longer crashes Closing ticket.