Project: titanium
Issue TIMOB-19801: Android: CardView causes crash when cardCornerRadius AND backgroundColor are set
The following sample demonstrates that the app crashes when you use both the {{backgroundColor}} and {{cardCornerRadius}} property on a CardView. If you use {{cardBackgroundColor}} instead it works. {code:javascript} var win = Ti.UI.createWindow(); var card = Ti.UI.Android.createCardView({	top: 20,	left: 20,	right: 20,	contentPadding: 20,	// Remove and it won't crash	cardCornerRadius: 20,	// Rename to cardBackgroundColor and it won't crash	backgroundColor: '#F00' }); card.add(Ti.UI.createLabel({	text: 'Hello, world!',	color: '#000' })); win.add(card); win.open(); {code} *Logs* {code} [ERROR] TiApplication: (main) [478,478] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{test.android/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable; Titanium 5.1.0,2015/10/26 16:46,c914b0f [ERROR] TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{test.android/org.appcelerator.titanium.TiActivity}: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable [ERROR] TiApplication: android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) [ERROR] TiApplication: android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) [ERROR] TiApplication: android.app.ActivityThread.access$800(ActivityThread.java:151) [ERROR] TiApplication: android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) [ERROR] TiApplication: android.os.Handler.dispatchMessage(Handler.java:102) [ERROR] TiApplication: android.os.Looper.loop(Looper.java:135) [ERROR] TiApplication: android.app.ActivityThread.main(ActivityThread.java:5254) [ERROR] TiApplication: java.lang.reflect.Method.invoke(Native Method) [ERROR] TiApplication: java.lang.reflect.Method.invoke(Method.java:372) [ERROR] TiApplication: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) [ERROR] TiApplication: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) [ERROR] TiApplication: Caused by: java.lang.ClassCastException: android.graphics.drawable.ColorDrawable cannot be cast to android.support.v7.widget.RoundRectDrawable [ERROR] TiApplication: android.support.v7.widget.CardViewApi21.setRadius(CardViewApi21.java:36) [ERROR] TiApplication: android.support.v7.widget.CardView.setRadius(CardView.java:281) [ERROR] TiApplication: ti.modules.titanium.ui.widget.TiUICardView.processProperties(TiUICardView.java:62) [ERROR] TiApplication: org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1209) [ERROR] TiApplication: org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:505) [ERROR] TiApplication: org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:496) [ERROR] TiApplication: org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:474) [ERROR] TiApplication: org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:512) [ERROR] TiApplication: org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:496) [ERROR] TiApplication: org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:474) [ERROR] TiApplication: org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:675) [ERROR] TiApplication: org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.jav [ERROR] TiApplication: ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:237) [ERROR] TiApplication: org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:33) [ERROR] TiApplication: org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:501) [ERROR] TiApplication: org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:594) [ERROR] TiApplication: org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18) [ERROR] TiApplication: android.app.Activity.performCreate(Activity.java:5990) [ERROR] TiApplication: android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) [ERROR] TiApplication: android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) [ERROR] TiApplication:	... 10 more -- End application log ------------------------------------------------------- {code}
Story points: 1