Hi all, I have downloaded the image from given url,and displayed in the imageview,which works fine in the emulator .but not works in real device... whats the problem?
Here my code
final String url = urlStr;
InputStream inputStream = null;
try {
inputStream = httpRequest.openHttpConnection(url);
if(inputStream!=null)
{
bitmap = BitmapFactory.decodeStream(inputStream);
if(bitmap!=null)
{
width=bitmap.getWidth();
height=bitmap.getHeight();
int newWidth = 50;
int newHeight = 50;
// calculate the scale - in this case = 0.4f
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
// create matrix for the manipulation
Matrix matrix = new Matrix();
// resize the bit map
matrix.postScale(scaleWidth, scaleHeight);
// recreate the new Bitmap
resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0,width, height, matrix, true);
}
inputStream.close();
}
}
catch (IOException e1)
{
e1.printStackTrace();
}
return resizedBitmap;