Posts tagged ‘ImageView’

From start itself BlackBerry 10 Cascades framework has not supported loading images to ImageView element directly from web URL. This was really disappointing considering originally QML supports this. It made it really tough to port a number of apps to BlackBerry 10. Thankfully folks at BlackBerry support forum gave a solution, WebImageView. I had been using something similar for my apps ever since.

 

WebImageView problem. See image in center column repeating twice in 2nd and 4th row.

WebImageView problem. See image in center column repeating twice in 2nd and 4th row.

But WebImageView, for some weird reasons, some problem with QNetworkDiskCache or ListView rendering brings another problem where wrong images are loaded on wrong items when shown in ListView. This is quite annoying when app is running with slower Internet. All my BlackBerry 10 apps used to suffer from this problem. I tried a lot of things, even downloading and saving the image first before loading it to ImageView but nothing worked. But recently I think I’ve found a fix. While using WebImageView when QNetworkReply is finished, I added a check in slot if the reply is for the same url for which it is requested. This worked and I’m really happy now. Now I’m adding this to all my apps for a better experience. Funny how a single line of code can solve long withstanding problem!

Code with this change included can be found on Github at