Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-19801

Android: CardView causes crash when cardCornerRadius AND backgroundColor are set

    Details

    • Type: Bug
    • Status: Closed
    • Priority: None
    • Resolution: Cannot Reproduce
    • Affects Version/s: Release 5.1.0
    • Fix Version/s: None
    • Component/s: Android
    • Labels:
      None
    • Environment:

      SDK 5.1.0.v20151026164636

    • Story Points:
      1
    • Sprint:
      2015 Sprint 24 SDK

      Description

      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.

      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();
      

      Logs

      [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: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325)
      [ERROR] TiApplication: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)
      [ERROR] TiApplication: 	at android.app.ActivityThread.access$800(ActivityThread.java:151)
      [ERROR] TiApplication: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
      [ERROR] TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java:102)
      [ERROR] TiApplication: 	at android.os.Looper.loop(Looper.java:135)
      [ERROR] TiApplication: 	at android.app.ActivityThread.main(ActivityThread.java:5254)
      [ERROR] TiApplication: 	at java.lang.reflect.Method.invoke(Native Method)
      [ERROR] TiApplication: 	at java.lang.reflect.Method.invoke(Method.java:372)
      [ERROR] TiApplication: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
      [ERROR] TiApplication: 	at 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: 	at android.support.v7.widget.CardViewApi21.setRadius(CardViewApi21.java:36)
      [ERROR] TiApplication: 	at android.support.v7.widget.CardView.setRadius(CardView.java:281)
      [ERROR] TiApplication: 	at ti.modules.titanium.ui.widget.TiUICardView.processProperties(TiUICardView.java:62)
      [ERROR] TiApplication: 	at org.appcelerator.kroll.KrollProxy.setModelListener(KrollProxy.java:1209)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:505)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:496)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:474)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.proxy.TiViewProxy.realizeViews(TiViewProxy.java:512)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleGetView(TiViewProxy.java:496)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.proxy.TiViewProxy.getOrCreateView(TiViewProxy.java:474)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.proxy.TiViewProxy.handleAdd(TiViewProxy.java:675)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.proxy.TiViewProxy.add(TiViewProxy.jav
      [ERROR] TiApplication: 	at ti.modules.titanium.ui.WindowProxy.windowCreated(WindowProxy.java:237)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.TiActivityWindows.windowCreated(TiActivityWindows.java:33)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.TiBaseActivity.windowCreated(TiBaseActivity.java:501)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:594)
      [ERROR] TiApplication: 	at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
      [ERROR] TiApplication: 	at android.app.Activity.performCreate(Activity.java:5990)
      [ERROR] TiApplication: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
      [ERROR] TiApplication: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)
      [ERROR] TiApplication: 	... 10 more
      -- End application log -------------------------------------------------------
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                msamah Ashraf Abu (Inactive)
                Reporter:
                fokkezb Fokke Zandbergen
                Reviewer:
                Ashraf Abu (Inactive)
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-20557
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code