×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Apr 2009
    Posts
    3

    Arrow Problem while accessing the files/folders from the phone

    HI .....actually i m using this code in my midlet ...to browse the phone memory & memory card of my phone

    public class FileBrowser extends MIDlet implements CommandListener
    {
    private String currDirName;

    private Command open = new Command("Open", Command.ITEM, 1);
    private Command back = new Command("Back", Command.BACK, 2);
    private Command exit = new Command("Exit", Command.EXIT, 3);

    private final static String UP_DIRECTORY = "..";
    private final static String MEGA_ROOT = "/";
    private final static String SEP_STR = "/";
    private final static char SEP = '/';

    public FileBrowser()
    {
    currDirName = MEGA_ROOT;
    }

    public void startApp()
    {
    boolean isAPIAvailable = false;
    if (System.getProperty("microedition.io.file.FileConnection.version") != null)
    {
    isAPIAvailable = true;
    try
    {
    showCurrDir();
    }
    catch (SecurityException e)
    {}
    catch (Exception e) {}
    }
    else
    {
    StringBuffer splashText = new StringBuffer(
    getAppProperty("MIDlet-Name")).append("\n").append(
    getAppProperty("MIDlet-Vendor")).append(isAPIAvailable?"":"\nFileConnection API not available");
    Alert splashScreen = new Alert(null,splashText.toString(),null,AlertType.INFO);
    splashScreen.setTimeout(3000);
    Display.getDisplay(this).setCurrent(splashScreen);
    }

    }

    public void pauseApp() {}

    public void destroyApp(boolean cond)
    {
    notifyDestroyed();
    }

    public void commandAction(Command c, Displayable d)
    {
    if (c == open)
    {
    List curr = (List)d;
    final String currFile = curr.getString(curr.getSelectedIndex());
    new Thread(new Runnable()
    {
    public void run()
    {
    if (currFile.endsWith(SEP_STR) || currFile.equals(UP_DIRECTORY))
    {
    traverseDirectory(currFile);
    } else
    {
    // showFile(currFile);
    }
    }
    }).start();
    }
    else if (c == back)
    {
    showCurrDir();
    }
    else if (c == exit)
    {
    destroyApp(false);
    }
    }

    void showCurrDir()
    {
    Enumeration e;
    FileConnection currDir = null;
    List browser;
    try
    {
    if (MEGA_ROOT.equals(currDirName))
    {
    e = FileSystemRegistry.listRoots();
    browser = new List(currDirName, List.IMPLICIT);
    }
    else
    {
    currDir = (FileConnection)Connector.open("file://localhost/" + currDirName);
    e = currDir.list();
    browser = new List(currDirName, List.IMPLICIT);
    //browser.append(UP_DIRECTORY,null);

    }
    while (e.hasMoreElements())
    {
    String fileName = (String)e.nextElement();
    if (fileName.charAt(fileName.length()-1) == SEP)
    {
    browser.append(fileName,null);
    }
    else
    {
    browser.append(fileName,null);
    }

    }
    browser.setSelectCommand(open);
    browser.addCommand(exit);
    browser.setCommandListener(this);
    if (currDir != null)
    {
    currDir.close();
    }
    Display.getDisplay(this).setCurrent(browser);
    }
    catch (IOException ioe)
    {}
    }

    void traverseDirectory(String fileName)
    {
    if (currDirName.equals(MEGA_ROOT))
    {
    /* if (fileName.equals(UP_DIRECTORY))
    {
    // can not go up from MEGA_ROOT
    return;
    } */
    currDirName = fileName;
    }
    /*else if (fileName.equals(UP_DIRECTORY))
    {
    // Go up one directory
    // TODO use setFileConnection when implemented
    int i = currDirName.lastIndexOf(SEP, currDirName.length()-2);
    if (i != -1)
    {
    currDirName = currDirName.substring(0, i+1);
    }
    else
    {
    currDirName = MEGA_ROOT;
    }
    } */
    else
    {
    currDirName = currDirName + fileName;
    }
    showCurrDir();
    }
    }


    But the problem is my N72 is only showing this : -

    Phone Memory/
    C:/
    Memory Card/
    E:/


    When i select any one of C or E drive....it gives a prompt which says :-

    Allow application to read the phone data after selecting YES....it says [no data].

    Also when i run same application on Nokia 3110c, it runs fine & after showing C: & E: .. it gives an Application error & on selecting details it gives SecurityException.

    However when i run same application on my frend's Nokia 6681 & N 73 ......it works fine .... show all the files/folders & they even show 2 prompts which says :-

    Allow application to read the phone data and
    Allow application to write the phone data

    Plzz help me ......what will i do to run this app. in my N 72 ???

  2. #2
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: Problem while accessing the files/folders from the phone

    Hi,
    please check the settings for reading and writing data to device in app manager of device. goto app manager of device select ur application, then select suite settings from options here u can check for permissions. Set permission to allow to read and write data to filesystem.
    hope this makes sense to u.
    thanks,
    jitu_goldie..

    KEEP TRYING..

  3. #3
    Registered User
    Join Date
    Apr 2009
    Posts
    3

    Re: Problem while accessing the files/folders from the phone

    Quote Originally Posted by jitu_goldie View Post
    Hi,
    please check the settings for reading and writing data to device in app manager of device. goto app manager of device select ur application, then select suite settings from options here u can check for permissions. Set permission to allow to read and write data to filesystem.
    hope this makes sense to u.
    Hey thanx buddy ......... now everything is fine .....thanx again

  4. #4
    Registered User
    Join Date
    Apr 2009
    Posts
    3

    Re: Problem while accessing the files/folders from the phone

    @ jitu_goldie ....hey buddy ....could u also give me the steps to sign the midlet .......i m using wireless toolkit 2.5.2 or any link which will guide me to sign a midlet

    Thanx in advance

  5. #5
    Super Contributor
    Join Date
    Sep 2008
    Location
    Noida, U.P.
    Posts
    1,330

    Thumbs up Re: Problem while accessing the files/folders from the phone

    Quote Originally Posted by dhruva_scd View Post
    @ jitu_goldie ....hey buddy ....could u also give me the steps to sign the midlet .......i m using wireless toolkit 2.5.2 or any link which will guide me to sign a midlet

    Thanx in advance
    your welcome. sorry cant give u proper information. Please search on net.
    thanks,
    jitu_goldie..

    KEEP TRYING..

  6. #6
    Super Contributor
    Join Date
    Jun 2007
    Location
    Mumbai
    Posts
    539

    Re: Problem while accessing the files/folders from the phone

    Check out these links for signing

    http://wiki.forum.nokia.com/index.ph...ess_in_Java_ME
    http://wiki.forum.nokia.com/index.ph...ning_-_Java_ME

    and u can also check procedure at Verisign stie.
    au revoir
    Prakash Raman

Similar Threads

  1. PC-Bluetooth Modem problem and question:
    By wireaudio in forum Bluetooth Technology
    Replies: 4
    Last Post: 2007-10-13, 05:27
  2. Replies: 0
    Last Post: 2007-07-14, 13:35
  3. 7210 Silent Problem
    By MarkMckim in forum Mobile Java General
    Replies: 1
    Last Post: 2003-03-18, 12: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
  •  
×