Saturday, 30 March 2013

how to develop android application for xxhdpi device Samsung S4, HTC one, Sony Xperia z etc

New giant innovation Samsung Galaxy S4,Sony Xperia Z and HTC one are coming in android history.  S4 new dimension has created excitement for android user. Lets see what S4  and these phone contains

Samsung S4   - 1080x1920 resolution with a high pixel density of 441ppi, Screen size of 4.99 inch
HTC one          - 1080x1920 resolution with a high pixel density of 478ppi, Screen little less than 4.99 inch
Sony Xperia Z - 1080x1920 resolution with a high pixel density of 441ppi, Screen size of 4.99 inch

Android user are happy because they will get phenomal quality of display. as well as developer are shocked as their application need to support one more device. Still we have following device type on the base of density

drawable-hdpi                               -  high density
drawable-ldpi                             -  low  density(almost remove from android)
drawable-mdpi                              -  Small Screen device with medium density
drawable-tvdpi                            
drawable-xhdpi                             -  Extra high density
drawable-xlarge-mdpi                   -  Large screen with medium density

So if our application support all these device, then we need to keep one image of every type in each folder for bettter look. But because of above phone we have to take extra care about new density drawable-xxhdpi

While increasing support for above drawable-xxhdpi phone (as they are about to come in market) then we have to follow these steps to ensure best application and keep these image in seperate folder inside res named drawable-xxhdpi

Step 1) Your designer should make image by keeping in mind that device resolution is 1080x1920



Step 2) How to test without real device. No body had these device as they are still to launch or if they launch too then it will take time to get this device for developer. So we have to add new device definition of 1080x1920 to create a new emulator. See the screen shot

Step 3) Now you can run your application on this emulator, above steps will make this device definition available in Graphical Layout. you can check the design


Challenge - Consider a case when you take picture from such a high definition device, and this same image are used one the other device ! How difficult will be to handle these images without exceeding your application heap size. for that we have to scale image. It will add overhead to developer.

Keep in mind everything and then develop your new application. You can not take a risk to avoid the support for these device.

Android News and source code