Reusing default Android image gallery?

不想你离开。 提交于 2019-12-04 09:12:08
  1. The Gallery application has no rights to access files in your application's storage directory.

  2. The Gallery application is not part of the Android operating system.

  3. The Gallery application is routinely replaced by device manufacturers with their own implementations, so even if you found some screwy back-door to the regular Gallery application that enabled this, it probably would not work on many devices.

  4. Android itself, in the open source project, has two Gallery applications (Gallery and Gallery3D), and I don't know which are necessarily on any device (if either) or which is the one that you think supplies "the default image gallery functionality".

However, those Gallery applications are open source, and so you are welcome to copy whatever code you like out of them.

You can use this code to get the gallery started. Code for Video is

        Intent intent = new Intent();
        intent.setType("video/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, "Select Video"), 666);

code for Image is

        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, "Select Video"), 666);

And after getting the thing form the gallery , you can do whatever you want from it Do post if you need to ask anything else Thanks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!