Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Nov 2005

    Question FileConnection question

    Hi There,

    I'm slowly desiging a game, I've not really hit a snag but I would like some advice here,

    Most levels of games are added to the JAR file and parsed from there to access the levels.

    I decided that this was a bit flat and there is no room for improvements like extra levels etc, so I though about having the levels in the same directory as the program

    I know from my research I can load a file from a device using the FileConnection API, but here is the puzzling question??

    (Q) If I'm running my Midlet (Game etc), how do I retrive the complete directory tree that the Midlet is in, as this would need to be passed on to the FileConnection class methods.

    furthermore I know I could put the levels on the MediaCard but this seem a little silly to me!!

    could I have some advice Please

    the pig..

  2. #2
    Super Contributor
    Join Date
    Nov 2003
    Bangalore , India

    Re: FileConnection question

    I have already posted some links on some introduction to FileConnection. Please check this link

    In which phone are you trying? Please note that you cannot access all folders of the device from a Java app.

    The FileSystemRegistry has the static method listRoots() to list the available and supported mounted roots on the device. The list is returned as an Enumeration :
    Enumeration e =  FileSystemRegistry.listRoots();
    while (e.hasMoreElements()) {
                String rootName = (String)e.nextElement();
     System.out.println("mounted root:"+rootName);
    Hope this helps!


  3. #3
    Registered User
    Join Date
    Nov 2005

    Thumbs up Re: FileConnection question

    Hi there Thanks for your reply,

    I had a post about this in another forum, but I though I would reply here just to give his and my ideas on this subject.

    Because you have no way of retrieving the directory that your program is run in, it must be done another way.

    you need some sort of non-recursive directory search function, it is non-recursive mainly because of stack space in any mobile device (its at a premium). this will be slower than it's recursive brother but will use less stack because of it.

    the pig..

  4. #4
    Super Contributor
    Join Date
    Mar 2005

    Re: FileConnection question

    the point is that your program is not necessarly in a 'directory' (like a browsable folder)
    it depends on the operating system.
    my suggestion is that you give a particular extension to your levels files, and look for them on a non-recursive maner with a breadth-first algorithm, which may take some time, or you add a navigation module so that the user can browse the file system to find the levels

Similar Threads

  1. FileConnection SecurityException Access Denied?
    By sbwoodside in forum Mobile Java General
    Replies: 8
    Last Post: 2008-07-23, 12:41
  2. (FileConnection) Share apps between 6600 and 6630
    By matteopiccioni in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2006-06-21, 21:59
  3. fileconnection api
    By beenicravi in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2005-08-08, 14:51
  4. Java FileConnection Optional Package 1.0 (JSR 75)
    By thecrowi in forum Mobile Java General
    Replies: 0
    Last Post: 2004-09-24, 08:29
  5. Replies: 2
    Last Post: 2004-01-08, 18:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts