一个类似微信图片选择加载控件(以适配安卓6.0以上)

原文Github地址:https://github.com/AlexZhuo/AlxImageLoader

下载里面的源码到项目

调用

Intent intent = new Intent(this,SelectPhotoActivity.class);
Bundle bundle=new Bundle();
bundle.putInt("selectedPhotoNum",adapter.getItemCount());
intent.putExtras(bundle);
startActivityForResult(intent,10);

在onActivityResult()

  @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        Log.i("Alex","mainActivity的onActivityResult req="+requestCode+"    result="+requestCode);
        if(data == null || resultCode != SelectPhotoActivity.SELECT_PHOTO_OK)return;
        boolean isFromCamera = data.getBooleanExtra("isFromCamera",false);
        final ArrayList<SelectPhotoAdapter.SelectPhotoEntity> selectedPhotos = data.getParcelableArrayListExtra("selectPhotos");
        Log.i("Alex","选择的图片是"+selectedPhotos);
    }