Search code examples
apache-flexairflex4flex4.5

How can develop adobe mobile project for iPad, iPhone and Android in Single Code Base for managing DPI calculation and UI?


How can i maintain DPI resolution calculation for various device and UI management for eg, iPhone having action bar at top/bottom , iPad app has control bar component instead.Is it possible to maintain application in SINGLE CODE BASE.

Please suggest any alternate way to manage

Please help me.


Solution

  • You have a few approaches to take.

    First, the Flex Framework basically boils everything down into three different DPIs. 240dpi is most phones. 160dpi is most tablets. And 320dpi is the iPhone 4. Even though the DPIs are not exactly 160, 240, or 320 the framework uses an approximation to figure out the best DPI to use.

    Based on that; You can use the Application.applicationDI. Then the Flex Framework will automatically adjust things for different DPI resolutions based on that settings. So, if you design your app for 160; the app will automatically adjust when run on a screen that is 240. It works pretty well.

    The second choice is to write your own layout code to handle different assets and positioning. If you use FXG elements, they are vector based and can easily scale to any device. You could consider making all your assets square; which means it will probably look good no matter what DPI you switch it to.