【问题标题】:select multiple images in Android Gallery在 Android 图库中选择多张图片
【发布时间】:2012-03-11 21:11:01
【问题描述】:

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

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

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

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

提前致谢!!!

【问题讨论】:

标签: android android-gallery image-uploading


【解决方案1】:

我已经参考了这两个链接link 1

1Select Multiple Images Using GalleryViewlink 2

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

希望对你有所帮助。

【讨论】:

    【解决方案2】:

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

    https://github.com/derosa/MultiImageChooser

    希望对你有用!

    【讨论】:

    • 这是一个很好的解决方案。它仍然需要一些改进,因为它在向下/向上滚动时并不平滑。
    • @PareshMayani true,但这与缩略图请求方法有关。有一天我会重新编码以使其异步。
    • 我已经这样做了 :) 将在我的博客上发布相同的文章。
    • 我有一个问题,我如何整合它以便它可以由 startActivityForResult() 启动
    【解决方案3】:
     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-choose-custom-gallery.html

    【讨论】:

      猜你喜欢
      • 2013-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-27
      相关资源
      最近更新 更多