Qa

Q. Why do I need to name certain controls within the TabHost control with specific Android id attributes?

A. Occasionally, you will find situations in which you need to name layout controls with specific names in order for the controls to work properly. The more complex a control, the more likely it requires a bit of "glue" (or "magic") for the Android system to load the right templates and resources to display the control in a familiar way. Usually, these kinds of naming requirements are documented in the Android SDK.

Q. There is a bit of a delay when loading the scores screen. Why?

A. There are a number of reasons this screen appears less responsive than other screens. First, you are parsing XML, which can be a costly operation. Second, you create a large number of View controls to display the score data. You must always be careful to offload intense processing from the main UI thread to make the application more responsive and avoid unnecessary shutdown by the Android system. You could easily add a worker thread to handle the XML, and you might also consider other, more efficient, controls for displaying the score data. Finally, with Eclipse, when the debugger is attached, performance of an application greatly degrades.

0 0

Post a comment