Load password protected image to imageview with Picasso Image loader Library in android -


i getting image url protected password.i know how authenticator want picasso. can please tell me how load password protected images imageview picasso image loader library.

below code authenticator:

private bitmap download_image(string url) {              bitmap bmp = null;             try {                 url ulrn = new url(url);                 authenticator.setdefault(new authenticator() {                     protected passwordauthentication getpasswordauthentication() {                         return new passwordauthentication(imagepassword, "mypass".tochararray());                     }                 });                 httpurlconnection con = (httpurlconnection) ulrn.openconnection();                 inputstream = con.getinputstream();                 bmp = bitmapfactory.decodestream(is);                 if (null != bmp)                     return bmp;              } catch (exception e) {                 e.printstacktrace();             }             return bmp;          } 

i believe you're looking for. post says done using okhttp.

how add basic authentication in picasso 2.5.2 okhttp 3.2.0

good luck. :)

edit

you can set image image view below.

picasso.with(context).load("your image url here").into(imageview); 

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -