Open lawrenz opened 11 years ago
Not sure if this is any interest anymore, but the way I solved this was to use a code similar to this;
String userInfo = Uri.parse(imagePathString).getUserInfo();
if (userInfo != null) {
String[] components = userInfo.split(":", 1);
final String username = components[0],
password = (components.length > 1) ? components[1] : "";
Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password.toCharArray());
}
});
}
Because all my images are at the same base path I'll call this in my Application.onCreate function and pass my base path as imagePathString. In another scenario where you have images on different basic authentication protected spaces you'd have to call this code before each request going through to Smart Image View.
How can i use this if i try to load from a URL that has basic authentication?