Android-PickPicture

Introduction: 读系统相册图片工具,每个项目都要写大量重复代码,此工具已封装好,在线程在完成读取,并且有回调接口(开始、成功、失败)
More: Author   ReportBugs   
Tags:
系统相册-相机相册-

读取系统相册图片工具类,此库没有 UI 层,是考虑到每个项目的 UI 各有千秋,所以不打算加入 UI 部分,如有需要可Issues或加入 QQ 群:435173211 提出意见

引用

compile 'com.mylhyl:pickpicture:1.0.0'

下载 jar

效果图

使用

1、先读取相册目录列表数据集合

        pickPictureHelper = PickPictureHelper.readPicture(this, new PickPictureCallback() {
            @Override
            public void onStart() {
                //显示进度条
                mProgressDialog = ProgressDialog.show(PickPictureTotalActivity.this, null, "正在加载");
            }

            @Override
            public void onSuccess(List<PictureTotal> list) {
                mProgressDialog.dismiss();
                //读取成功,返回 list,直接丢入到 ListView 适配器中
                mListView.setAdapter(new PickPictureTotalAdapter(PickPictureTotalActivity.this, list));
            }

            @Override
            public void onError() {
                mProgressDialog.dismiss();
            }
        });

2、点击目录列表进入详细,也就是显示当前选择的目录所有的图片

        mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {

            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                                    int position, long id) {
                List<String> childList = pickPictureHelper.getChildPathList(position);
                PickPictureActivity.gotoActivity(PickPictureTotalActivity.this, (ArrayList<String>) childList);
            }
        });
Apps
About Me
GitHub: Trinea
Facebook: Dev Tools