diff --git a/imagepicker/src/main/java/com/lzy/imagepicker/ImageDataSource.java b/imagepicker/src/main/java/com/lzy/imagepicker/ImageDataSource.java index e5b75b9..07e540e 100644 --- a/imagepicker/src/main/java/com/lzy/imagepicker/ImageDataSource.java +++ b/imagepicker/src/main/java/com/lzy/imagepicker/ImageDataSource.java @@ -40,6 +40,7 @@ public class ImageDataSource implements LoaderManager.LoaderCallbacks { private FragmentActivity activity; private OnImagesLoadedListener loadedListener; //图片加载完成的回调接口 private ArrayList imageFolders = new ArrayList<>(); //所有的图片文件夹 + private boolean isLoad; /** * @param activity 用于初始化LoaderManager,需要兼容到2.3 @@ -76,6 +77,8 @@ public Loader onCreateLoader(int id, Bundle args) { @Override public void onLoadFinished(Loader loader, Cursor data) { + if (isLoad) return; + isLoad = true; imageFolders.clear(); if (data != null) { ArrayList allImages = new ArrayList<>(); //所有图片的集合,不分文件夹