private synchronized void asyncExecute( int type, final Runnable runnable, final TaskCallBack callback) { if (mTaskList.size() >= 10) { FileManageTask task = mTaskList.remove(0); task.cancel(); } FileManageTask task = new FileManageTask(type, runnable, callback); mTaskList.add(task); task.execute(); }
private synchronized void cleanup() { if (mAudioCategory != null) { mAudioCategory.clear(); } if (mVideoCategory != null) { mVideoCategory.clear(); } if (mImageCategory != null) { mImageCategory.clear(); } if (null != mTaskList) { for (FileManageTask task : mTaskList) { task.cancel(); } mTaskList.clear(); } unregisterReceiver(); mDeletedImageList.clear(); mDeletedAudioList.clear(); mDeletedVideoList.clear(); }