MIDlet: How to read configuration?

Discussion in 'Java' started by Simon Brooke, Oct 11, 2006.

  1. Simon Brooke

    Simon Brooke Guest

    OK, I'm trying to learn how to build a MIDlet. I'm an experienced
    server-side Java programmer, but I'm new to Micro Edition. The problem I'm
    looking at just now is how do I read configuration for the MIDlet at
    startup time?

    In the MIDlet package as I understand it, I don't have java.io.File, and I
    don't have java.util.Properties, so I can't do

    Properties config = new Properties()
    config.load( new FileInputStream( new File( CONFIGFILENAME)));

    I have a whole variety of configuration variables which I don't want to
    hardcode in the MIDlet, and which it isn't reasonable to expect the user
    to key in on some crappy mobile phone keypad each startup. So there must
    be an easy way to do this...

    I need the configuration file to be easy to maintain, so a simple text file
    like a Java properties file stored in a resource seems to me the best
    solution.

    --
    (Simon Brooke) http://www.jasmine.org.uk/~simon/

    Morning had broken, and there was nothing we could do but wait
    patiently for the RAC to arrive.
     
    Simon Brooke, Oct 11, 2006
    #1
    1. Advertisements

  2. Simon Brooke

    Simon Brooke Guest

    in message <>, Simon Brooke
    ('') wrote:

    > OK, I'm trying to learn how to build a MIDlet. I'm an experienced
    > server-side Java programmer, but I'm new to Micro Edition. The problem
    > I'm looking at just now is how do I read configuration for the MIDlet at
    > startup time?


    D'oh!

    Just in case anyone does a google search on this question some time in the
    future, the answer is you store config as name/value pairs in the
    application descriptor (jad) file, and access them using

    getAppProperty( String)

    See
    http://developers.sun.com/techtopics/mobility/midp/ttips/getAppProperty/

    I have to say I discovered this after /completely/ reinventing the wheel
    using rms.

    Sorry for asking damn fool questions.

    --
    (Simon Brooke) http://www.jasmine.org.uk/~simon/

    ;; Diplomacy, American: see Intelligence, Military
     
    Simon Brooke, Oct 12, 2006
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGFsb21hIEdhcmPDrWE=?=

    Error trying to read Custom Configuration Sections

    =?Utf-8?B?UGFsb21hIEdhcmPDrWE=?=, Sep 26, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    534
    Kevin Spencer
    Sep 26, 2005
  2. Mark
    Replies:
    0
    Views:
    1,052
  3. Karthikesh Raju

    best way to read a configuration file

    Karthikesh Raju, Mar 3, 2004, in forum: Python
    Replies:
    5
    Views:
    640
    Kevin Dahlhausen
    Mar 3, 2004
  4. matt
    Replies:
    1
    Views:
    517
  5. Talal Itani
    Replies:
    5
    Views:
    3,812
    Darryl L. Pierce
    Feb 25, 2007
  6. Replies:
    3
    Views:
    605
  7. Tech Id
    Replies:
    14
    Views:
    1,575
    Tech Id
    May 23, 2010
  8. matt
    Replies:
    1
    Views:
    230
    Dominick Baier
    Sep 25, 2006
Loading...