Why is the following bit of code returns Height: -1 which means that the height is yet not known. How to get height of the image?
try { // Create a
Because the image is loaded asynchronously, in the background.
As the getHeight() javadoc says, you need to provide an ImageObserver (instead of null), which is called when the image has been loaded.
getHeight()
null