Smig
Smig

Reputation: 693

What is the recommended way to package many photos in Codename One?

I'm developing an app that'll show a catalog of hundreds of products, each with a photo. In thinking how to deploy those images in Codename One, I found two options:

1) I can insert them in the resources file and fetch them with fetchResourceFile().getImage(). The downside is that, because they're so many, and because there's no folder system in the resources file gui, it'll make it hard to find icons and other images in the mix.

2) Copy them to the root folder and fetch them with Image.createImage(). I find this preferable because I can leverage the OS's applications to find/replace/rename them directly; but like before, it'll mix them up with other files that share the same requirement, like the resources file, xml files and others.

My question is, is there a better way of packaging them in a way that will keep them separate from other resources and keep things organized?

Upvotes: 0

Views: 79

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

You can't rename or change anything about images that you place in the SRC directory since they will be packaged in the jar or .app bundle both of which are unmodifiable. There is a platform dependent size limit for bundles so if your app grows too much it just won't install in the various OS's.

The best way is to include a subset of the images in the resource file and then as the app is launched start downloading the rest in the background to avoid a big application overhead.

Upvotes: 1

Related Questions