GithubHelp home page GithubHelp logo

xiaobao4955 / mutiphotochoser Goto Github PK

View Code? Open in Web Editor NEW

This project forked from laomengzhu/mutiphotochoser

0.0 2.0 0.0 5.96 MB

可以多选的图片选择器

License: Mozilla Public License 2.0

Java 100.00%

mutiphotochoser's Introduction

MutiPhotoChoser

一款支持多选的图片选择器,支持Android2.0+

Screenshot

使用(详见app目录)

配置AndroidManifest.xml

1、添加权限:

 <!--SD卡读写权限-->
 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
 <uses-permission android:name="ANDROID.PERMISSION.WRITE_EXTERNAL_STORAGE" />

2、声明GalleryActivity:

<activity android:name="com.ns.mutiphotochoser.GalleryActivity">
    <intent-filter>
        <!--***改成应用的包名-->
        <action android:name="***.action.CHOSE_PHOTOS" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>

调起图片选择页面选择图片

//***改成应用的包名
Intent intent = new Intent("***.action.CHOSE_PHOTOS");
//指定图片最大选择数
intent.putExtra(Constant.EXTRA_PHOTO_LIMIT, 5);
startActivityForResult(intent, REQUEST_PICK_PHOTO);

处理选择结果

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode != Activity.RESULT_OK) {
        return;
    }

    switch (requestCode) {
        case REQUEST_PICK_PHOTO:
            ArrayList<String> images = data.getStringArrayListExtra(Constant.EXTRA_PHOTO_PATHS);
            mAdaper.swapDatas(images);
            break;
    }
}

项目依赖

该库使用了"Android-Universal-Image-Loader"处理图片缓存,github地址:[https://github.com/nostra13/Android-Universal-Image-Loader](https://github.com/nostra13/Android-Universal-Image-Loader);

License

Mozilla Public License, version 2.0

mutiphotochoser's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.