public Bitmap downloadImageFromWeb(String url)
{
Bitmap bitmap = null;
InputStream in;
try
{
//Creation of url
URL url_img = new URL(url);
//Establishing Connection
in = url_img.openStream();
//Converting input stream to bitmap
bitmap = BitmapFactory.decodeStream(in);
//Closing the input stream
in.close();
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
return bitmap;
}
{
Bitmap bitmap = null;
InputStream in;
try
{
//Creation of url
URL url_img = new URL(url);
//Establishing Connection
in = url_img.openStream();
//Converting input stream to bitmap
bitmap = BitmapFactory.decodeStream(in);
//Closing the input stream
in.close();
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
return bitmap;
}
No comments:
Post a Comment