j2me中如何下载后台图片?
我有一张画布,在中心显示一张图像。该图像是通过 url 下载的。实际上还有更多图像需要下载,这意味着如果用户单击右侧,我必须显示下一张图像,如果单击左侧,我必须从背面显示另一张图像。我有存储 url 图像的字符串数组。我想在背景中下载上一张和下一张图像。怎么做呢?
I have one canvas where I am showing one image on center. This image is downloaded by url. Actually there are more images to be downloaded, that means if user clicks RIGHT I have to show next image if LEFT, I have to show another one image from backside. I have array of strings which storing images of url. I want to download previous and next image in background. How to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
以下是您需要考虑的一些问题,以便此要求能够在多种设备上工作。
等等……
牢记上述一系列问题,您将为您的问题找到一个建设性的答案,那就是创建一个网络 IO 管理器和一个缓存管理器。
。
。
现在,对于每个图像(当前、左侧或右侧),调用 CacheManager.fetchImage(),此方法将负责为您提供缓存或从服务器下载的图像。在相同的方法中,如果图像未缓存,它将向
NetworkIoManager
pendingQueue 添加 NetworkIoItem 对象并下载它。下载完成后,它将触发NetworkIoItem.onImageDownload(...)
方法。您可以使用 J2ME Polish 的 Touch 功能下载
中的图像NetworkIoManager
通过使用此方法,您将对请求 URL 进行异步图像获取。
Following are some of the issues that you need to consider for this requirement to work across a range of devices
and the list continues.....
Keeping in mind the above set of issues that you will land-up with a constructive answer to your problem is to create a network IO manager and a caching manager.
.
.
Now for each image (current, left or right) call the
CacheManager.fetchImage()
, this method will take care of providing you image either cached or downloaded from server. In the same method if the image is not cached it will addNetworkIoItem
objbect to theNetworkIoManager
pendingQueue and download it. On completion of download it will triggerNetworkIoItem.onImageDownload(...)
method.You can use J2ME Polish's Touch feature to download a image in the
NetworkIoManager
By using this approach you will do asynchronous image fetches to the request URL.
做一些像..
Do something like..