Android Image未在Imageview中加载

时间:2017-04-19 07:41:07

标签: android imageview android-glide

我正在使用库(https://github.com/darsh2/MultipleImageSelect)从手机中选择图像,然后在Imageview中显示它。有些图像加载有效,但有些图像根本没有加载。我用谷歌搜索解决方案,但没有发现任何问题。有谁知道如何解决这个问题?

以下是代码:

 photo_choose.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(AddPharmacy.this, AlbumSelectActivity.class);
                //set limit on number of images that can be selected, default is 10
                intent.putExtra(Constants.INTENT_EXTRA_LIMIT, 1);
                startActivityForResult(intent, Constants.REQUEST_CODE);
            }
        });

 @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == Constants.REQUEST_CODE && resultCode == RESULT_OK && data != null) {
            //The array list has the image paths of the selected images
            ArrayList<Image> images = data.getParcelableArrayListExtra(Constants.INTENT_EXTRA_IMAGES);
            for(int i=0;i<images.size();i++){
                String path=images.get(i).path;
                if(i==0){

                    Glide.with(getApplicationContext()).load(path).skipMemoryCache(true).into(img1);
                    path1 = path.substring(path.lastIndexOf("."));
                }

            }
        }
    }

0 个答案:

没有答案