Hi All,
I am trying to download the image from the server. Here i am getting
the problem, some times the image is not getting download it is
showing empty. In server i kept the bitmap image. I am using the
following code to download the image.
private Bitmap downloadImageFile(String fileUrl) {
URL myFileUrl = null;
try {
myFileUrl = new URL(fileUrl);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
HttpURLConnection conn = (HttpURLConnection)
myFileUrl.openConnection();
conn.setDoInput(true);
conn.connect();
int length = conn.getContentLength();
InputStream is = conn.getInputStream();
bmImg = BitmapFactory.decodeStream(is); // some times
im getting
this as null
} catch (IOException e) {
e.printStackTrace();
bmImg = null;
}
return bmImg;
}
Please give me your suggestions.
Thanks in Advance,
Muthu Kumar K.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---