title: width and height must be > 0 while creating bitmap
body: <p>I am working on an android app. Google Map and Marker clustering is impemented in my app. App is running fine on 4.4 and lollipop devices. I am creating custom marker using the following code and recieving following error
  <em>java.lang.IllegalArgumentException: width and height must be > 0</em></p>
  
  <p>I am using this code for creating custom bitmap as marker</p>
  
  <pre><code>private Bitmap getMarkerBitmapFromView(@DrawableRes int resId,String typeProfile) {
  
      View customMarkerView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.custom_marker_view, null);
      RelativeLayout _markerType = (RelativeLayout) customMarkerView.findViewById(R.id.markertype);
      ImageView markerImageView = (ImageView) customMarkerView.findViewById(R.id.image);
      //ImageView markerStatus = (ImageView) customMarkerView.findViewById(R.id.onlieStatus);
  
      if(typeProfile.equals("blue")) {
          _markerType.setBackgroundResource(R.drawable.markr_general);
  
  
      } else if(typeProfile.equals("green")){
          _markerType.setBackgroundResource(R.drawable.markr_interest);
  
  
      } else if(typeProfile.equals("red")) {
          _markerType.setBackgroundResource(R.drawable.markr_profession);
  
  
      }
  
      markerImageView.setImageResource(resId);
      customMarkerView.measure(View.MeasureSpec.EXACTLY, View.MeasureSpec.EXACTLY);
      customMarkerView.layout(0, 0, customMarkerView.getMeasuredWidth(), customMarkerView.getMeasuredHeight());
      customMarkerView.buildDrawingCache();
      Bitmap returnedBitmap = Bitmap.createBitmap(customMarkerView.getMeasuredWidth(), customMarkerView.getMeasuredHeight(),
              Bitmap.Config.ARGB_8888);
      Canvas canvas = new Canvas(returnedBitmap);
      canvas.drawColor(Color.WHITE, PorterDuff.Mode.SRC_IN);
      Drawable drawable = customMarkerView.getBackground();
      if (drawable != null)
          drawable.draw(canvas);
      customMarkerView.draw(canvas);
      return returnedBitmap;
  
  }
  </code></pre>
  
  <p>here is my code marker rendring class</p>
  
  <pre><code> private class PersonRenderer extends DefaultClusterRenderer&lt;Person&gt; {
      private final IconGenerator mIconGenerator = new IconGenerator(getApplicationContext());
      private final IconGenerator mClusterIconGenerator = new IconGenerator(getApplicationContext());
      private final CircleImageView mImageView;
      private final CircleImageView mClusterImageView;
      private final int mDimension;
  
  
      public PersonRenderer() {
          super(getApplicationContext(), mMap, mClusterManager);
  
          View multiProfile = getLayoutInflater().inflate(R.layout.custom_marker_view, null);
          mClusterIconGenerator.setContentView(multiProfile);
          mClusterImageView = (CircleImageView) multiProfile.findViewById(R.id.image);
  
          mImageView = new CircleImageView(getApplicationContext());
          mDimension = (int) getResources().getDimension(R.dimen.custom_profile_image);
          mImageView.setLayoutParams(new ViewGroup.LayoutParams(mDimension, mDimension));
          int padding = (int) getResources().getDimension(R.dimen.custom_profile_padding);
          mImageView.setPadding(padding, padding, padding, padding);
          mIconGenerator.setContentView(mImageView);
  
      }
  
      @Override
      protected void onBeforeClusterItemRendered(Person item, MarkerOptions markerOptions) {
         mImageView.setImageResource(item.profilePhoto);
  
  
          markerOptions.icon(BitmapDescriptorFactory.fromBitmap(getMarkerBitmapFromView(item.profilePhoto,item.profileType))).title("asfas");
           //Bitmap icon = mIconGenerator.makeIcon();
         // markerOptions.icon(getMarkerBitmapFromView(item.profilePhoto)).title(item.name);
      }
  
      @Override
      protected void onBeforeClusterRendered(Cluster&lt;Person&gt; cluster, MarkerOptions markerOptions) {
        /*  List&lt;Drawable&gt; profilePhotos = new ArrayList&lt;Drawable&gt;(Math.min(4, cluster.getSize()));
          int width = mDimension;
          int height = mDimension;
  
  
          MultiDrawable multiDrawable = new MultiDrawable(profilePhotos);
          multiDrawable.setBounds(0, 0, width, height);
  
          mClusterImageView.setImageDrawable(multiDrawable);
          Bitmap icon = mClusterIconGenerator.makeIcon(String.valueOf(cluster.getSize()));*/
  
  
  
  
          if(cluster.getSize() == 2) {
  
              markerOptions.icon(BitmapDescriptorFactory.fromBitmap(getClusteredMarkerBitmapFromView(R.drawable.for_two,2,cluster)));
  
          } else if(cluster.getSize() == 3) {
  
              markerOptions.icon(BitmapDescriptorFactory.fromBitmap(getClusteredMarkerBitmapFromView(R.drawable.for_three,3,cluster)));
  
          } else if(cluster.getSize()  == 4) {
  
              markerOptions.icon(BitmapDescriptorFactory.fromBitmap(getClusteredMarkerBitmapFromView(R.drawable.images_for,4,cluster)));
  
          } else if(cluster.getSize() &gt; 4) {
  
              markerOptions.icon(BitmapDescriptorFactory.fromBitmap(getClusteredMarkerBitmapFromView(R.drawable.images_for,cluster.getSize(),cluster)));
  
          }
  
  
      }
  
      @Override
      protected boolean shouldRenderAsCluster(Cluster cluster) {
          // Always render clusters.
          return cluster.getSize() &gt; 1;
      }
  }
  </code></pre>