Search code examples
androidvideoaudiocameraandroid-gallery

Android open source activity to let the user select/create a media?


In my open source app, I want to let users insert a picture/video/sound/etc. The user can either select an existing media from the SD card or use the device's hardware (take a photo, record a video, record a sound, draw on touchscreen) if they prefer to create a new media.

There are plenty of code snippets showing how to implement each of these things, but rather than re-inventing the wheel, is there a library that handles the whole activity of choosing a media file? I would just call this library, it would handle the UI, and return me the filepath to the media the user selected/created.

Here is how it could look like:

Android media chooser

I am sure many apps would find this widget useful (CMS authoring, wysiwyg, sharing apps, rich chat, ...). As an LGPL (or public domain) component, I am sure it would be popular and gather a community of developers. Before I launch this project, is there already such a gadget?


Solution

  • I wrote a small Android Library Project, called aFileChooser, that aims to streamline the selection part of this process. It includes a built-in file explorer, and returns a File object after selection. You can also retrieve the image or video thumbnail, and use helper methods to get the URI and path.

    Disclaimer: I haven't had a chance to test this with ICS, but it should function properly.

    https://github.com/iPaulPro/aFileChooser

    Finding an all-in-one solution with capture may not be as easy, as this is one of the areas where fragmentation is real.