在 Android 图库中选择多张图像

发布于 2025-01-08 05:37:03 字数 376 浏览 3 评论 0原文

我正在使用一个应用程序,该应用程序具有从 android 内置 Gallery/Camera 选择多个图像的功能。

使用以下代码成功打开图库。

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

但我只能从图库中选择一张图像。所以请建议我如何从内置图库中选择多个图像。

提前致谢 !!!

i m working with one application that have one functionality to select multiple images from android inbuilt Gallery/Camera .

Gallery is open successfully using below code.

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

but i am able to select only One image from Gallery. so please suggest me how to select multiple images from inbuilt gallery .

Thanks in Advance !!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

长梦不多时 2025-01-15 05:37:03

我参考了这两个链接链接1

1使用 GalleryView 选择多个图像链接 2

但没有得到我正在寻找的答案..但我找到了替代方案 解决方案 。从内置图库中获取所有图像并将其设置为我们所有的自定义 Gellery ..请查看此链接 带有复选框的自定义图库

我希望它会对您有所帮助。

i had refer this two link link 1

1: Select Multiple Images Using GalleryView and link 2

but not getting Ans for which i m looking for .. but i have found alternative solution . Get all images from inbuilt Gallery and set it all our custom Gellery .. kindly check out this link Custom Gallery with checkbox

i hope it will help you.

宣告ˉ结束 2025-01-15 05:37:03

嗯,这是一个老问题,但我想这可能对某人仍然有用。
我刚刚发布了多图像选择活动的源代码。您可以在以下 GitHub 存储库中找到它:

https://github.com/derosa/MultiImageChooser

我希望这对你有用!

Well, this is an old question, but I guess this might be still useful to somebody.
I just released the source code for my multiple image selection activity. You can find it in the following GitHub repo:

https://github.com/derosa/MultiImageChooser

I hope it's useful for you!

若沐 2025-01-15 05:37:03
 Cursor imagecursor1 = managedQuery(
    MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null,
    null, orderBy + " DESC");

   this.imageUrls = new ArrayList<String>();
  imageUrls.size();

   for (int i = 0; i < imagecursor1.getCount(); i++) {
   imagecursor1.moveToPosition(i);
   int dataColumnIndex = imagecursor1
     .getColumnIndex(MediaStore.Images.Media.DATA);
   imageUrls.add(imagecursor1.getString(dataColumnIndex));
  }

   options = new DisplayImageOptions.Builder()
  .showStubImage(R.drawable.stub_image)
  .showImageForEmptyUri(R.drawable.image_for_empty_url)
  .cacheInMemory().cacheOnDisc().build();

   imageAdapter = new ImageAdapter(this, imageUrls);

   gridView = (GridView) findViewById(R.id.PhoneImageGrid);
  gridView.setAdapter(imageAdapter);

你想要更多的澄清。 http://mylearnandroid.blogspot.in/2014/02/multiple -选择-自定义-gallery.html

 Cursor imagecursor1 = managedQuery(
    MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null,
    null, orderBy + " DESC");

   this.imageUrls = new ArrayList<String>();
  imageUrls.size();

   for (int i = 0; i < imagecursor1.getCount(); i++) {
   imagecursor1.moveToPosition(i);
   int dataColumnIndex = imagecursor1
     .getColumnIndex(MediaStore.Images.Media.DATA);
   imageUrls.add(imagecursor1.getString(dataColumnIndex));
  }

   options = new DisplayImageOptions.Builder()
  .showStubImage(R.drawable.stub_image)
  .showImageForEmptyUri(R.drawable.image_for_empty_url)
  .cacheInMemory().cacheOnDisc().build();

   imageAdapter = new ImageAdapter(this, imageUrls);

   gridView = (GridView) findViewById(R.id.PhoneImageGrid);
  gridView.setAdapter(imageAdapter);

You want to more clarifications. http://mylearnandroid.blogspot.in/2014/02/multiple-choose-custom-gallery.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文