public void destroy ( boolean removeFromQueue ) { if ( mState == State . IDLE ) { return ; } if ( removeFromQueue ) { mThreadPoolExecutor . remove ( this ) ; } if ( mState == State . DECODED ) { mMemoryCache . put ( getCacheKey ( ) , mBitmap ) ; } mBitmap = null ; mDrawingOptions . inBitmap = null ; // since tiles are pooled and reused, make sure to reset the cache key or you'll render the wrong tile from cache mCacheKey = null ; mState = State . IDLE ; mListener . onTileDestroyed ( this ) ; }
we use this signature to call from the Executor so it can remove tiles via iterator