Issue:
Android ImageView was not displaying image on Redmi Note Prime, when tested. But the same code when used in Redmi 4A shows image.
Solutions tried:
- Setting Image using XML
Used:android:src
- Setting image using Java code
Used:ImageView img;
img = (ImageView) findViewById(R.id.startscreen);
img.setImageResource(R.drawable.startimage); - Setting background to different colour
Used:android:background
- Changing the background colour of image
- Using AppCompat
Used:app:srcCompat
Solution that worked:
After googling all possible methods, we came across a comment where ‘Resizing the image’ was an option.
Initially, our image had a resolution of 1587 x 2245. We reduced the pixels by half (50%). And then tried without changing the code. Changing the image resolution did the trick for us !
In case you are stuck with image being displayed on a device and not on another, either use multi-resolution content, or use content that fits into all.