The place where the players are created is important. Proper application design can reduce the amount of bugs that are hard to find. The following tips may reduce MMAPI-related bugs in MIDlets:
Do not try to create players before the execution of the startApp()
method
of the MIDlet has begun. For example, do not try to create player objects
in the MIDlet constructor or static sections. These are executed before the startApp()
method
of the MIDlet.
Problems will occur if you create players in the constructors of classes that have members of their object type in the MIDlet or which are further instantiated because of the MIDlet construction.
Pool players to reduce unnecessary player object re-creation. However, pool only the needed players, because S60 devices have limits on the amount of devices that can be prepared. The amount depends on the device platform (for example, in S60 3rd Edition devices, the limit is around 40).