James Boswell wrote:
Using a Set would remove duplication of categories i.e. duplicate categories specified in the text file.
By the way, does your web service use an XSD for its interface? You could use the schema to define the categories and also handle duplicates.
Campbell Ritchie wrote:It is also probably better to create constants in a class than an interface; there is then no temptation to implement it and have those constants part of the public interface of the class too. An enum is a special kind of class, so that follows the same principle.
Paul Mrozik wrote:Thanks a lot Steve.
I'm using an outdated Java (TIJ 3rd Ed.) book where I found this:
Because any fields you put into an interface are automatically static and final, the interface is a convenient tool for creating groups of constant values, much as you would with an enum in C or C++
SOAP has become unfashionable due to its overhead. Consider using a RESTful WS that transports JSON (Android has a JSOn API built in).
Storing it in memory is tricky, as Android may decide to kill your app at any given moment. Either use the built in SQLite DB, or store the raw JSON in internal or external storage: http://developer.android.com/guide/topics/data/data-storage.html. The latter is what I would do.