Rob Spoor wrote:Although your code still has a few bugs* it's very informative indeed. I didn't know it existed before reading this thread.
- The building of the tree map can be probably be done inside the first SwingWorker, either in its doInBackground method (when not required to run on the EDT) or in its done method (when required to run on the EDT).
- You don't check the results of fileChooser.showOpenDialog(this). If the user canceled you will see "Not a directory!" on your console.
- There is a double cast to List on line 14/15 of your first code snippet.
John Todd wrote:I'm happy Java is moving but nothing caught my eyes in Java 7. invokedynamic is cool any way.
I hope Java 8 will bring much more exciting and important features to the table.
Maybe it is time to announce Scala programming language as the second official language on the JVM.
Dave MacLean wrote:If you're using an HTTP connection to download the images, there's a way to enable caching within it, so you might achieve what you want that way. Every time you start your app, it would go fetch the images, which may not be exactly what you want. But while your app is running, a new fetch should just find the image in the HTTP cache and avoid another fetch over the network.
Otherwise, you should be able to create an image folder on the SD card to store your downloaded files. Save them off in a format that doesn't require conversion next time you read it back in. Also, if you put an empty file with the filename ".nomedia" in the directory with your image files, Gallery will ignore them. Technically the media scanner will ignore them so Gallery never finds out about them.