1

I have a need of creating a image gallery. The images are saved in the remote server. The Blackberry client need to download and render it to the UI (Gallery View).

I have used "UniversalImageDownloaer" library for android. But now for I am looking for any such freeware/open source lib that will help me to serve my purpose for BlackBerry. Can Anyone help me guiding me to a resource.

I need to look into the following things

  1. Async image download
  2. Gallery view
  3. Image caching

Edit-1 From my earlier experience, I understand that Blackberry has the restriction for creating maximum of 250 (Many be 5+/-) number of threads at run time. And per application it is restricted to 17 number of threads. So I must look into the thread pool and thread safety for my requirements.

4

1 回答 1

1

我不知道任何用于延迟加载 BB 的库。您可以尝试将该库移植到黑莓或 DIY。让我们看看你是如何做到这一点的:

  1. 您可以编写一个消费者线程,该线程将一次下载一个图像(在黑莓中,并行下载不会有太大的性能改进)。这个消费者可以从堆栈中获取 URL。UI(屏幕、列表)会在每次需要图像时向消费者提交请求。该请求只是将资源 URL 传递给使用者,以便将其放在堆栈的顶部。同时,GUI 应显示默认图像或加载消息。Java中有很多关于如何以线程安全的方式设计消费者-生产者方案的好书和手册,但这超出了这个答案的范围。
  2. 从 OS 5.0 开始,您拥有PictureScrollField类,该类允许您显示一行滚动图像,并且可以在一定程度上进行自定义。我认为 SDK 的示例文件夹中有一个示例演示应用程序。
  3. 如果在程序执行期间可能对同一图像进行多个请求,则缓存是一种有趣的增强功能。您可以将它们保存在消费者堆栈的 RAM 中,甚至可以将它们保存到 SDCard 中的文件夹中。然后消费者将首先在缓存中查找,只有在它不存在的情况下才会启动远程下载。
于 2012-10-09T09:02:54.090 回答