{"id":3538,"url":"https://github.com/alhazmy13/MediaPicker","last_synced_at":"2025-08-03T20:32:37.156Z","repository":{"id":88125469,"uuid":"45092496","full_name":"alhazmy13/MediaPicker","owner":"alhazmy13","description":"Media Picker is an Android Libary that lets you to select multiple images or video","archived":true,"fork":false,"pushed_at":"2020-06-29T07:04:07.000Z","size":415,"stargazers_count":269,"open_issues_count":30,"forks_count":85,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-12-02T13:48:25.665Z","etag":null,"topics":["android","images","media","mediapicker","picker","video"],"latest_commit_sha":null,"homepage":"alhazmy13.net","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alhazmy13.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2015-10-28T06:06:54.000Z","updated_at":"2024-11-01T00:03:06.000Z","dependencies_parsed_at":"2023-10-20T16:36:48.432Z","dependency_job_id":null,"html_url":"https://github.com/alhazmy13/MediaPicker","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhazmy13%2FMediaPicker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhazmy13%2FMediaPicker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhazmy13%2FMediaPicker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhazmy13%2FMediaPicker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alhazmy13","download_url":"https://codeload.github.com/alhazmy13/MediaPicker/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228567009,"owners_count":17937983,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","images","media","mediapicker","picker","video"],"created_at":"2024-01-05T20:16:44.337Z","updated_at":"2024-12-07T05:30:39.698Z","avatar_url":"https://github.com/alhazmy13.png","language":"Java","funding_links":[],"categories":["Libraries"],"sub_categories":["GUI"],"readme":"\u003cp align=\"left\"\u003e\n  \u003cimg src=\"https://cloud.githubusercontent.com/assets/4659608/12700433/4276edc0-c7f3-11e5-9f2c-de6bcbb9416d.png\" width=\"600\"\u003e\n\u003c/p\u003e\n\n# Media Picker\n![](https://img.shields.io/badge/Platform-Android-brightgreen.svg)\n![](https://img.shields.io/hexpm/l/plug.svg)\n![](https://img.shields.io/badge/version-2.4.4-blue.svg)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/ea51407d60d04c938c263de206095abf)](https://www.codacy.com/app/me_101/MediaPicker?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=alhazmy13/MediaPicker\u0026utm_campaign=badger)\n\n\n**[Please let me know if your application go to production via this link](https://docs.google.com/forms/d/e/1FAIpQLSe4Y5Fwn1mlEoD4RxjXQzTvL4mofhESuBlTkAPQhI7J_WqMDQ/viewform?c=0\u0026w=1)**\n------\nMedia Picker is an Android Libary that lets you to select multiple images, video or voice for Android 4.1 (API 16) +.\nYou can report any issue on issues page. **Note: If you speak Arabic, you can submit issues with Arabic language and I will check them. :)**\n\n# NOTE\n----\nThis build `2.x.x` will break backward compatibility and there are a lot of changes to improve the performance and fix a lot of Leak memory issues, So please read below document carefully.\n## Installation\n------\n**Maven**\n\n```xml\n\u003cdependency\u003e\n\u003cgroupId\u003enet.alhazmy13.MediaPicker\u003c/groupId\u003e\n\u003cartifactId\u003elibary\u003c/artifactId\u003e\n\u003cversion\u003e2.4.4\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n\n**Gradle**\n\n```gradle\ndependencies {\n\timplementation 'net.alhazmy13.MediaPicker:libary:2.4.4'\n}\n```\n\n# Usage\n------\n## Images\nAfter adding the library, you need to:\n\n1. Create an object from `ImagePicker` or `VideoPicker`\n2. Override `onActivityResult` to receive the path of image or videos.\n\n\n\n### Create an `ImagePicker`\nYou will need to create a new instance of `ImagePicker`. Once the instance are configured, you can call `build()`.\n\n```java\n        new ImagePicker.Builder(MainActivity.this)\n                        .mode(ImagePicker.Mode.CAMERA_AND_GALLERY)\n                        .compressLevel(ImagePicker.ComperesLevel.MEDIUM)\n                        .directory(ImagePicker.Directory.DEFAULT)\n                        .extension(ImagePicker.Extension.PNG)\n                        .scale(600, 600)\n                        .allowMultipleImages(false)\n                        .enableDebuggingMode(true)\n                        .build();\n```\n### Override `onActivityResult `\nIn order to receive the path of image, you will need to override `onActivityResult ` .\n\n```java\n   @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        super.onActivityResult(requestCode, resultCode, data);\n\n        if (requestCode == ImagePicker.IMAGE_PICKER_REQUEST_CODE \u0026\u0026 resultCode == RESULT_OK) {\n            List\u003cString\u003e mPaths = data.getStringArrayListExtra(ImagePicker.EXTRA_IMAGE_PATH);\n            //Your Code\n        }\n    }\n```\n\n### Additional Options\n* `mode` to select the mode, you can choose one of these `CAMERA`,`GALLERY` or `CAMERA_AND_GALLERY`\n\n```java\n.mode(ImagePicker.Mode.CAMERA)\n```\n\n* `extension` You can change the extension of image to `PNG` or `JPG`\n\n```java\n.extension(ImagePicker.Extension.PNG)\n```\n* `compressLevel` You can change the quality of image with three different levels `HARD`,`MEDIUM`, `SOFT` or `NONE`\n\n```java\n.compressLevel(ImagePicker.ComperesLevel.MEDIUM)\n```\n\n* `directory` You can pass the storage path, or select `Directory.DEFAULT_DIR` to keep the default path.\n\n```java\n.directory(ImagePicker.Directory.DEFAULT)\n\n//OR\n\n.directory(Environment.getExternalStorageDirectory()+\"/myFolder\")\n\n```\n\n* `scale` You can scale the image to a a minimum width and height. This will only be used if compressLevel is set. To avoid OutOfMemory issues, ensure this is used.\n\n```java\n.scale(500, 500)\n```\n* `allowMultipleImages` Extra used to select and return multiple images from gallery **CANNOT select single image from gallery if this feature was enabled**\n\n```java\n\t.allowMultipleImages(true)\n```\n\n* `enableDebuggingMode` used to print Image Picker Log\n\n```java\n\t.enableDebuggingMode(true)\n```\n\n* `allowOnlineImages` an option to allow the user to select any image from online resource ex: Google Drive **(KNOWN ISSUE) if you enable this option then you cannot select multiple images**\n\n```java\n\t.allowOnlineImages(true)\n```\n\n\n### Create an `VideoPicker`\nYou will need to create a new instance of `VideoPicker`. Once the instance are configured, you can call `build()`.\n\n```java\n        new VideoPicker.Builder(MainActivity.this)\n                        .mode(VideoPicker.Mode.CAMERA_AND_GALLERY)\n                        .directory(VideoPicker.Directory.DEFAULT)\n                        .extension(VideoPicker.Extension.MP4)\n                        .enableDebuggingMode(true)\n                        .build();\n```\n### Override `onActivityResult `\nIn order to receive the path of videos, you will need to override `onActivityResult ` .\n\n```java\n   @Override\n    protected void onActivityResult(int requestCode, int resultCode, Intent data) {\n        super.onActivityResult(requestCode, resultCode, data);\n\n        if (requestCode == VideoPicker.VIDEO_PICKER_REQUEST_CODE \u0026\u0026 resultCode == RESULT_OK) {\n            List\u003cString\u003e mPaths =  data.getStringArrayListExtra(VideoPicker.EXTRA_VIDEO_PATH);\n            //Your Code\n        }\n    }\n```\n\n### Additional Options\n* `mode` to select the mode, you can choose one of these `CAMERA`,`GALLERY` or `CAMERA_AND_GALLERY`\n\n```java\n.mode(VideoPicker.Mode.CAMERA)\n```\n\n* `extension` You can change the extension of video to `MP4` \n\n```java\n.extension(VideoPicker.Extension.MP4)\n```\n\n* `directory` You can pass the storage path, or select `Directory.DEFAULT_DIR` to keep the default path.\n\n```java\n.directory(VideoPicker.Directory.DEFAULT)\n\n//OR\n\n.directory(Environment.getExternalStorageDirectory()+\"/myFolder\")\n\n```\n\n* `enableDebuggingMode` used to print Video Picker Log\n\n```java\n\t.enableDebuggingMode(true)\n```\n\n### RxJava 2 for MediaPicker\n\nIt's an extenstion that allow you to return an observable from `ImagePickerBuilder` or `VideoPickerBuilder`, all you need is to add below dependency and then return the observable from `ImagePickerHelper` || `VideoPickerHelper` class.\n\n\n**Gradle**\n\n```gradle\ndependencies {\n  implementation 'io.reactivex.rxjava2:rxandroid:(Last_version)'\n  implementation 'io.reactivex.rxjava2:rxjava:(Last_version)'\n\timplementation 'net.alhazmy13.MediaPicker:rxjava:(Last_version)'\n}\n```\n\n```Java\n  new ImagePickerHelper(\n        new ImagePicker.Builder(Context)\n                ...)\n                .getObservable()\n                .subscribe(....);\n```\n\n------\n\n\n## Theme the pickers\n\nYou can change the strings be overwriting below resources in your project.\n\n```xml\n\n    \u003cstring name=\"media_picker_select_from\"\u003eSelect From:\u003c/string\u003e\n    \u003cstring name=\"media_picker_camera\"\u003eCamera\u003c/string\u003e\n    \u003cstring name=\"media_picker_gallery\"\u003eGallery\u003c/string\u003e\n    \u003cstring name=\"media_picker_ok\"\u003eOk\u003c/string\u003e\n    \u003cstring name=\"media_picker_cancel\"\u003eCancel\u003c/string\u003e\n    \u003cstring name=\"media_picker_some_permission_is_denied\"\u003eSome Permission is Denied\u003c/string\u003e\n    \u003cstring name=\"media_picker_you_need_to_grant_access_to\"\u003eYou need to grant access to\u003c/string\u003e\n    \u003cstring name=\"media_picker_read_Write_external_storage\"\u003e\u003c![CDATA[Read \u0026 Write External Storage]]\u003e\u003c/string\u003e\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falhazmy13%2FMediaPicker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falhazmy13%2FMediaPicker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falhazmy13%2FMediaPicker/lists"}