Import the prism-lib module in your project and then add the following in your build.gradle file
...
dependencies {
compile project(':prism-lib')
}
...
Currently this library supports APIs that return Bitmap and String only, but will be extended to other formats in the future.
There are two ways to fetch bitmap using Prism
Prism.getInstance()
.loadBitmapFrom(url, requestTag)
.into(imagView)
.execute();
OR
Prism.getInstance()
.loadBitmapFrom(url, requestTag, new BitmapResponseListener() {
@Override
public void onResponse(Bitmap bitmap) {
}
@Override
public void onError(String errorMsg) {
}
}).execute();
Prism.getInstance()
.loadStringFrom(url, requestTag, new StringResponseListener() {
@Override
public void onResponse(String response) {
}
@Override
public void onError(String errorMsg) {
}
}).execute();
You can look at the source code of CacheLoading project which uses Prism Lib for its network operations https://github.com/ik024/prism-lib/tree/master/app