get params in animation returns null for imageview
===

I have a linear layout which expands when you click on it. It is done with an animation, and works pretty neath actually. Also an arrow switches from downpointing to uppointing.
I have four of these linear layouts, i included them in an other xml file in an linear layout.


The problem now is that i don't want my view to expand when the linear layout is clicked, but when an clickable imageview or button is pressed.
This is because in the part that expands are buttons or so, and i don't want my view to accidentally unexpand when you click wrong.

But when i do that my animation class gives an nullpointerException on the layout params. 

Here is my class:
   

     protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);   
            setContentView(R.layout.makemyday_buttons);
            //set booleans for arrows
            llPlacesArrowDown = true;
      
            llPlaces= (LinearLayout)findViewById(R.id.mmd_places);
            llPlacesArrow = (ImageView)llPlaces.findViewById(R.id.mmd_arrow);
    		
    		llPlaces.setOnClickListener(new View.OnClickListener() {
    			
    			@Override
    			public void onClick(View view) {
    				// what happens on click
    				View toolbar = view.findViewById(R.id.toolbar);
    				// change arrow
    				if(llPlacesArrowDown){
    				 llPlacesArrow.setImageResource(R.drawable.mmd_arrow_up);
    				 llPlacesArrowDown=false;
    				}else{
    					llPlacesArrow.setImageResource(R.drawable.mmd_arrow_down);
    					llPlacesArrowDown=true;
    				}
    
                    // Creating the expand animation for the item
                    ExpandAnimation expandAni = new ExpandAnimation(toolbar, 300);
    
                    // Start the animation on the toolbar
                    toolbar.startAnimation(expandAni);
                }
            });
        }
    }

an my animation (have this from [a tutorial][1]):

     public ExpandAnimation(View view, int duration) {
    
            setDuration(duration);
            mAnimatedView = view;
            mViewLayoutParams = (LayoutParams) view.getLayoutParams();
    
            // decide to show or hide the view
            mIsVisibleAfter = (view.getVisibility() == View.VISIBLE);
    
            mMarginStart = mViewLayoutParams.bottomMargin;
            mMarginEnd = (mMarginStart == 0 ? (0- view.getHeight()) : 0);
    
            view.setVisibility(View.VISIBLE);
        }
    
        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            super.applyTransformation(interpolatedTime, t);
    
            if (interpolatedTime < 1.0f) {
    
                // Calculating the new bottom margin, and setting it
                mViewLayoutParams.bottomMargin = mMarginStart
                        + (int) ((mMarginEnd - mMarginStart) * interpolatedTime);
    
                // Invalidating the layout, making us seeing the changes we made
                mAnimatedView.requestLayout();
    
            // Making sure we didn't run the ending before (it happens!)
            } else if (!mWasEndedAlready) {
                mViewLayoutParams.bottomMargin = mMarginEnd;
                mAnimatedView.requestLayout();
    
                if (mIsVisibleAfter) {
                    mAnimatedView.setVisibility(View.GONE);
                }
                mWasEndedAlready = true;
            }
        }

So the problem is that when i change my onclickListener to llPlacesArrow (the arrow in the included linear layout) i get an error in the getlayoutparams in my animation.

My xml files:
(one item)

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:orientation="vertical"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:background="@color/list_odd">
        
    <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="horizontal"
      
      >
      <B
      	  android:id="@+id/image"
    	  android:layout_width="50dp"
    	  android:layout_height="50dp" android:src="@drawable/ic_launcher" android:scaleType="centerCrop"
    	  android:layout_margin="10dp"
    	  android:layout_weight="1"
    	  />
      
      <LinearLayout
          android:layout_width="225dp"
          android:layout_height="wrap_content"
          android:orientation="vertical" >
    
      <TextView
          android:id="@+id/tvname"
          android:layout_width="225dp"
          android:layout_height="wrap_content"
          android:layout_gravity="left|top"
          android:layout_marginLeft="10dip"
          android:text="naam"
          android:textSize="16dip" 
          android:maxLines="1"
          android:ellipsize="marquee"
          android:textColor="@color/black"/>
    
     <TextView
         android:id="@+id/tvtip"
         android:layout_width="225dp"
         android:layout_height="wrap_content"
         android:layout_marginLeft="10dip"
         android:maxLines="3"
         android:text="tip"
         android:textSize="12dip" 
         android:ellipsize="end"
         android:textColor="@color/black"/>
    
     </LinearLayout>
     
     
     
     <ImageView 
         android:id="@+id/mmd_arrow"
          android:layout_width="wrap_content"
    	  android:layout_height="wrap_content"
    	  android:layout_weight="1"
    	  android:src="@drawable/mmd_arrow_down"
    	  android:layout_gravity="center_vertical"
    	  android:layout_margin="2dip"
    	  android:clickable="true"
         />
    
    </LinearLayout>

        <!--*** EXPANDING LAYOUT ****-->
    
       <LinearLayout android:id="@+id/toolbar"
              android:layout_marginBottom="-50dip"
              android:visibility="gone"
              android:layout_height="50dip"
              android:layout_width="fill_parent">
    
               
            <RelativeLayout
                 android:id="@+id/btn_refresh"
                android:layout_width="fill_parent"
                android:layout_weight="1"
                android:layout_height="50dip"
                android:focusable="false"
                android:focusableInTouchMode="false"
                android:orientation="horizontal">
    
                <ImageView
                    android:id="@+id/iv_refresh"
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:layout_alignParentLeft="true"
                    android:layout_centerVertical="true"
                    android:layout_margin="2dip"
                    android:src="@drawable/icon_refresh" />
    
                <TextView
                    android:id="@+id/tvrefresh"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:layout_margin="5dp"
                    android:layout_toRightOf="@+id/iv_refresh"
                    android:layout_weight="1"
                    android:ellipsize="end"
                    android:gravity="center_vertical"
                    android:maxLines="1"
                    android:text="Refresh"
                    android:textColor="@color/custom_button_grey_text"
                    android:textSize="12dip" />
                
                </RelativeLayout>
    
        
        </LinearLayout>
        
       <ImageView 
         android:id="@+id/bottom_border"
         android:layout_width="fill_parent"
    	  android:layout_height="wrap_content"
    	  android:src="@drawable/custombuttonlist_bottomborder"
         />
       
    </LinearLayout>

and:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" 
        android:background="@color/orange">
        
         <include
                android:id="@+id/mmd_places"
                layout="@layout/expandable_list_item" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"/>
          <include
                android:id="@+id/mmd_agenda"
                layout="@layout/expandable_list_item" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"/>
           <include
                android:id="@+id/mmd_shopping"
                layout="@layout/expandable_list_item" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"/>
            <include
                android:id="@+id/mmd_food"
                layout="@layout/expandable_list_item" 
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"/>
        
    
    </LinearLayout>

  [1]: http://udinic.wordpress.com/2011/09/03/expanding-listview-items/