Summary

Create a single executable

  • Your workload in testing and maintenance will be much lower with runtime adaptation in comparison to using the preprocessor to create multiple JAR files.

  • Use the preprocessor to include different resource files for local language variants and for differentiating your debug and release builds.

Adapt at runtime

  • Use selective enhancement and the delegation pattern to isolate optional features that are not available on all target phones.

  • System properties can provide a lot of information about the phone to support enabling enhancements.

Catch throwables

  • Runtime errors due to missing APIs on some phones can be handled as an alternate initialisation branch in the catch statement.

  • To reduce speed penalties if the code is executed frequently, set a variable to avoid throwing the error a second time.

Adapt your views based on current screen width and language

  • Most views have a vertical scrolling orientation, so height is often less restricted than width.

  • Scale images and views at runtime by screen width, then stamp any needed text on top using procedural graphics rather than static text in localised graphics.

  • Feel free to use either wider elements or more columns on a phone that is currently in the landscape orientation.

Pay special attention to keyboard usability

  • Your attention to detail should be on making it natural to enter text on all the various devices you support.

  • Ensure the virtual keyboard is automatically visible when needed and any additional softkeys needed on SDK 1.0 and SDK 1.1 phones are available. QWERTY and ITU-T keypad input devices may require subtle differences.