Android ImageView was not displaying image on Redmi Note Prime, when tested. But the same code when used in Redmi 4A shows image.
- Setting Image using XML
- Setting image using Java code
img = (ImageView) findViewById(R.id.startscreen);
- Setting background to different colour
- Changing the background colour of image
- Using AppCompat
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.