Code example for Queue

Methods: add, remove, size

0
 
      if (mask == null) {
         return; 
      } 
 
      if (mMaskQueue.size() == MAX_STATIC_MASKS) {
         Mask removeMask = mMaskQueue.remove();
         mScreenView.removeView(removeMask);
      } 
      // add a mask 
      mMaskQueue.add(mask);
      mScreenView.addView(mask);
      Rect rect = mask.getRect();
      mask.layout(rect.left, rect.top, rect.right, rect.bottom);
   } 
 
   public void removeMasks() { 
      mScreenView.removeAllViews();
      mMaskQueue.clear();
   }