简体   繁体   中英

Can't download image in Android

In my Asynctask's onPostExecute method

LinearLayout ll=(LinearLayout) findViewById(R.id.mylinlay);
TextView tv=new TextView(Download_İmage.this);
tv.setText("try");
ImageView tempimg=new ImageView(Download_İmage.this);
Glide.with(getApplicationContext()).load("http://inthecheesefactory.com/uploads/source/glidepicasso/cover.jpg").into(tempimg);
tv.setCompoundDrawables(tempimg.getDrawable(),null,null,null);
ll.addView(tv);

here adding all textview to linearlayout dynamically.All textviews with text looks ok and also tried with existed drawable image its working.But when i try to download image via picasso or glide its not working.So i cant get remote image.

com.bumptech.glide.Glide failed lock verification and will run slower. Have this message and same message for picasso as well.I am checked with debug option but that image drawable getting null.

After a quick Google, the only result that shows the same problem is this closed issue on Glide's GitHub.

Apparently, this error exists in older versions of Glide, but has been fixed in 2017. You should update your Glide version to the latest (currently 4.6.1):

  implementation 'com.github.bumptech.glide:glide:4.6.1'
  annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'

And in your project's build.gradle file:

repositories {
  mavenCentral()
  google()
}

you should use glide like this.

Glide.with(mContext)
                    .load("someurl")
                    .placeholder("your_placeHolder")
                    .fitCenter()
                    .error("your_errorImg")
                    .into(imageView);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM