Using strings effectively
Creating and manipulating String objects in your application can be time-consuming and use a lot of memory. For example, operations such as string concatenation create new String objects and should be performed as infrequently as possible.
You should try to create and cache static String objects outside of paint(). If you know in advance that the contents of a String object won't change while your application is running, you can move the creation of the String object into another method that is invoked less frequently. A good place to cache String objects is in the constructor of your screen. The constructor is invoked only once, when the screen is created, and you can save time and memory by creating and storing String objects in this method.