Durga Dutt Durga Dutt - 4 months ago 47
Android Question

Android Notification Icon

I am giving notification by a background service. In notification i am displaying an image , image dimensions are 15*15. But when image is showed it automatically streches to big size , so it became blur. I haven't specified the image size in my program. Why this is happening


That is because when specifying dimensions in Java it is automatically regarded as a pixel value.

You will have to implement a helper method somewhere, best in a helper class, which calculates and returns a density independent pixel value based on the provided pixel value.

The equation is px = dip * (density / 160) from which we get that dip = px / (density/160).

This answer here is even better actually.