With a number of different screen sizes and resolutions you can not rely on static pixel size alone. That is where Android uses dips, or Density Independent Pixels. The combination of screen size and resolution is measured in Dots Per Inch, that is, how many pixels can you fit on one inch ?

Each device falls into one of these categories:

Screen Shot 2015-09-11 at 23.12.50

When you read the Android developer guidelines on images you will see that Google always refers to dp when describing image sizes. To calculate the pixel size based on dpi you can use this conversion table :

Screen Shot 2015-09-11 at 23.15.03

What this means,- the pixel density on a XXXHDPI screen is four times higher than the pixel density on a MDPI device.

If you want to create a 48p sized icon the actual size in pixels is 48 pixels on a MDPI screen and 192 pixels on a XXXHDPI screen.

This might not be that useful to know by itself, but my next blog post will be about 9-patch images and knowing your dip is always a good start.

When creating a custom SSLSocketFactory or modifing the application in any other way is not an option

This example uses a Tomcat server listing for HTTPS connections on port 8443 but should work anywhere.

Retrieve the public key:

$openssl s_client -connect localhost:8443, then create a file localhost.pem that looks like


Import the key:

#keytool -import -alias localhost-selfsigned -keystore $JAVA_HOME/jre/lib/security/cacerts -file localhost.pem

When promted for password, write changeit

Restart JVM / Application server instance.