認識 Android-Universal-Image-Loader
https://github.com/nostra13/Android-Universal-Image-Loader
參數說明:
https://github.com/nostra13/Android-Universal-Image-Loader/wiki/Useful-Info
universal image loader 似乎內建直接用是 http + get, 要下載自有https 憑證會出問題。解法:
https://github.com/nostra13/Android-Universal-Image-Loader/issues/713
增加header 範例:
android universal image loader not caching or saving image
http://stackoverflow.com/questions/25424103/android-universal-image-loader-not-caching-or-saving-image
Map<String, String> headers = new HashMap<String, String>();
headers.put(“key”, Commons.CURRENT_ACTIVE_PROFILE.getKey());
headers.put(“secret”, Commons.CURRENT_ACTIVE_PROFILE.getSecret());
displayImageOptions = new DisplayImageOptions.Builder()
.extraForDownloader(headers)
使用範例:
https://github.com/haiwen/seadroid/search?utf8=%E2%9C%93&q=AuthImageDownloader
下載大頭照的:
app/src/main/java/com/seafile/seadroid2/avatar/AuthImageDownloader.java
Showing the top two matches. Last indexed on Sep 15, 2016.
public AuthImageDownloader(Context context, int connectTimeout,
呼叫的主程式:
app/src/main/java/com/seafile/seadroid2/SeadroidApplication.java
Showing the top two matches. Last indexed on Sep 15, 2016.
.imageDownloader(new AuthImageDownloader(context, 10000, 10000))
範例2號:
https://github.com/nostra13/Android-Universal-Image-Loader/issues/188
PS:
W/ImageLoader: Try to initialize ImageLoader which had already been initialized before. To re-init ImageLoader with new configuration call ImageLoader.destroy() at first.