I am trying to get an image from URL in Android and set it in a ImageView
. What I am doing is the following:
image = new ImageView(mContext);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(MY_WIDTH, MY_HEIGHT);
params.leftMargin = lefMargin;
params.topMargin = topMargin;
image.setImageBitmap(BitmapFactory.decodeStream((InputStream)new URL(MY_URL).getContent());
relativeLayout.addView(image, params);
But the image does not fit my size (MY_WIDTH, MY_HEIGHT), It is showed in its own size. What to do?