I want to load a image from a url and show it on an image view. The image is bigger than the image view and has a good resolution. But the image shown in the view is very blurry. The image is not that blur if I enlarge the image view. So I think its a scaling problem. I want to load the images dynamically, so I don't won't to download them. I tried several solutions from this question here: Bad image quality after resizing/scaling bitmap and also this one: How to scale an Image in ImageView to keep the aspect ratio but nothing worked. This is my code, for loading the image into the view:
Bitmap bm1 = BitmapFactory.decodeStream(new URL(url).openConnection().getInputStream());
runOnUiThread(() -> {
((ImageView) findViewById(R.id.simImg1)).setImageBitmap(bm1);
});
This is the image view
<ImageView
android:id="@+id/simImg1"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:layout_weight="1"
android:padding="5dp" />
This is the url for the Image: https://www.ingolstadt.de/media/custom/3052_32_1_g.JPG
This is what it looks like: Screenshot
Thank you in advance!