I have a query not particular to UniversalImageLoader but because i am trying to use the content stream to load the image i am facing following issue.
I am using input stream "stream://" to be able to use ImageLoader. Everything is working fine except that the hashcode of the input stream for the same request is generated differently and hence forces the imageloader to download the image again from the network instead of the disk.
What should i do to fix it.
PS: I tried to follow the answer from here
The code to get InputStream is (The UtilityMethod is noting just an async task):
public void displayContentImage(final String fileId, final ImageView imageView) {
UtilityMethods.startMyTask(new AsyncTask<Object, Void, InputStream>() {
@Override
protected InputStream doInBackground(Object... params) {
CMServiceGateway cmServiceGateway = new CMServiceGateway();
final InputStream inputStream = cmServiceGateway.GetContentAsStream(fileId);
if (inputStream != null) {
//String imageId = "stream://" + inputStream.hashCode();
//Log.d("ImageId :: 1 ::", "file id : " + fileId + "hashcode: " + imageId);
//String imageId2 = "stream://" + cmServiceGateway.GetContentAsStream(fileId).hashCode();
//Log.d("ImageId :: 2 ::", "file id : " + fileId + "hashcode: " + imageId2);
return inputStream;
}
return null;
}
@Override
protected void onPostExecute(InputStream inputStream) {
if (inputStream != null) {
displayImage(inputStream, imageView);
}
}
});
}