Search code examples
blackberryblackberry-jdelistfield

Loading image asynchronously blackberry


How to add images asynchronously on every row of an ListField?


Solution

  • Follow these steps.

    1. Use Model-View-Controller (MVC) pattern to plan your class hierachy and relationships.
    2. Use additional threads to load images and notify view listener (in MVC-notation) when an image has been loaded.

    Note, that a single application can create up to 16 threads. The total number of threads that can exist on a BlackBerry device from all applications is 128.

    Therefore, if an application has already created 16 threads, the 17th attempt fails and a TooManyThreadsError exception is thrown.

    Similarly, if there are 128 threads already created on the BlackBerry device and an application attempts to create another thread, a TooManyThreadsError exception is thrown.