捕获从图库中拍摄的照片

时间:2016-04-21 03:41:18

标签: android

我有一个方法可以启动图库,以便我可以选择照片(这可行)

public ArrayList<ImageEntry> pickImages(Context cont){
    Picker.PickListener pic = new MyPickListener();
    ArrayList<ImageEntry> images = new ArrayList<>();
    pic.onPickedSuccessfully(images);
    new Picker.Builder(cont, pic, R.style.MIP_theme)
            .build()
            .startActivity();
    return images;
}

除非我在相册中拍照,否则会返回

/storage/emulated/0/capture1461208914080.png

作为图像路径

当我尝试加载此图片时

  public class MyPickListener implements Picker.PickListener, View.OnLongClickListener {

    HorizontalScrollView imageScroll;
    LinearLayout imageLayout;
    LinkedList<View> thumbnails = new LinkedList<>();
    LinkedList<String> thumbnailsPaths = new LinkedList<>();

    @Override
    public void onPickedSuccessfully(final ArrayList<ImageEntry> images) {
        imageLayout = (LinearLayout) view.findViewById(R.id.thumbnail_layout);
        imageScroll = (HorizontalScrollView) view.findViewById(R.id.thumbnail_scroll);
        imageLayout.setHorizontalScrollBarEnabled(false);
        for(ImageEntry image : images){
            if (imageCount < 5) {
                imageCount++;
                imageScroll.setVisibility(View.VISIBLE);
                View view = viewBuilder.createThumbnail(getActivity(), image.path);
                thumbnails.add(view);
                thumbnailsPaths.add(image.path);
                view.setOnLongClickListener(this);
                imageLayout.addView(view);
                MainActivity.imageArray.add(image.path);
            }
        }
    }

我的问题是我需要做什么才能加载从图库中拍摄的图像。目前他们只显示为空,谢谢

0 个答案:

没有答案