opened
stripathi669
username_0
I am encoutering exception when adding BigImageButtonsCard.

The tracestack for the same is: 

    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toUpperCase()' on a null object reference
            at com.username_1.materialList.cards.view.BaseButtonsCardItemView.build(BaseButtonsCardItemView.java:37)
            at com.username_1.materialList.cards.view.BaseButtonsCardItemView.build(BaseButtonsCardItemView.java:15)
            at com.username_1.materialList.controller.MaterialListViewAdapter.getView(MaterialListViewAdapter.java:42)
            at com.nhaarman.listviewanimations.BaseAdapterDecorator.getView(BaseAdapterDecorator.java:125)
            at com.nhaarman.listviewanimations.appearance.AnimationAdapter.getView(AnimationAdapter.java:142)
            at android.widget.AbsListView.obtainView(AbsListView.java:2344)
            at android.widget.ListView.makeAndAddView(ListView.java:1864)
            at android.widget.ListView.fillDown(ListView.java:698)
            at android.widget.ListView.fillSpecific(ListView.java:1356)
            at android.widget.ListView.layoutChildren(ListView.java:1651)
            at android.widget.AbsListView.onLayout(AbsListView.java:2148)
            at android.view.View.layout(View.java:15596)
            at android.view.ViewGroup.layout(ViewGroup.java:4966)
            at android.support.v4.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:543)
            at android.view.View.layout(View.java:15596)
            at android.view.ViewGroup.layout(ViewGroup.java:4966)
            at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
            at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
            at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
            at android.view.View.layout(View.java:15596)
            at android.view.ViewGroup.layout(ViewGroup.java:4966)
            at android.support.v4.widget.DrawerLayout.onLayout(DrawerLayout.java:890)
            at android.view.View.layout(View.java:15596)
            at android.view.ViewGroup.layout(ViewGroup.java:4966)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
            at android.view.View.layout(View.java:15596)
            at android.view.ViewGroup.layout(ViewGroup.java:4966)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
            at android.view.View.layout(View.java:15596)
            at android.view.ViewGroup.layout(ViewGroup.java:4966)
            at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
            at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
            at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
            at android.view.View.layout(View.java:15596)
            at android.view.ViewGroup.layout(ViewGroup.java:4966)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
            at android.view.View.layout(View.java:15596)
            at android.view.ViewGroup.layout(ViewGroup.java:4966)
            at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1703)
            at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1557)
            at android.widget.LinearLayout.onLayout(LinearLayout.java:1466)
            at android.view.View.layout(View.java:15596)
            at android.view.ViewGroup.layout(ViewGroup.java:4966)
            at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
            at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
            at android.view.View.layout(View.java:15596)
            at android.view.ViewGroup.layout(ViewGroup.java:4966)
            at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2072)
            at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1829)
            at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
            at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
            at android.view.Choreographer.doCallbacks(Choreographer.java:580)
            at android.view.Choreographer.doFrame(Choreographer.java:550)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
            at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatc

I am using following code for creating and placing the card:

    public static Card getBigImageCard( final Context mContext)  {
        SimpleCard card = new BigImageButtonsCard(mContext);
       
        card.setDescription("Some Description");
        card.setTitle("SomeTitle");
        final String url = "wwww.google.com"
       // Code to get some drawable here
        card.setDrawable(d);

            ((BigImageButtonsCard) card).setDividerVisible(true);
           ((BigImageButtonsCard)card).setLeftButtonText("Open");
            ((BigImageButtonsCard)card).setLeftButtonText("Dismiss");

            ((BigImageButtonsCard)card).setOnLeftButtonPressedListener(new OnButtonPressListener() {
                               @Override
                               public void onButtonPressedListener(View view, Card card) {
                                   Intent urlIntent = new Intent(mContext, WebViewingActivity.class);
                                   urlIntent.putExtra("webUrl", url);
                                   mContext.startActivity(urlIntent);
                               } });


                    card.setDismissible(true);



        return card;
       }

Then to add the card:

    mListView.add(getBigImageCard( Activity.this );

The same code works for BigImage card (after removing the code for buttons & divider of-course.)
Error while adding BigImageButtonsCard
issue
created
stripathi669
username_0
I found the source of error. In your material_image_with_buttons_card.xml,

change android:id="@id/left_text_button"
to android:id="@+id/left_text_button"
comment
closed
dexafree
username_1
issue
created
dexafree
username_1
Fixed and uploaded to Maven Central.

Version 2.0.2 should be available in a couple of hours
comment