• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Loading properties file

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to load an image in my midlet but i want to set the path of my image in a properties file.can anyone help me how or perhaps give me an example on how to load a properties file?thanks in advance.
 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The MIDP APIs don't have any special support for property files, so you'll need to just open the property file as an InputStream and then parse it yourself:

You might find it more convenient to add some of your own properties to your MIDlet JAR file's manifest, or to the MIDlet JAD file: you can then read them using the method getAppProperty of class MIDlet. Here's an example from one of my MIDlet JAD files:

Then my MIDlet constructor just does:

You'll have no problems if you just add a few properties. But phones reasonably expect the JAD file to be small, so if you add very large amounts of properties you may run into problems on real phones.
[ November 02, 2003: Message edited by: David Price ]
 
It is difficult to free fools from the chains they revere - Voltaire. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic