×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Pune
    Posts
    223

    Reading text file stored in phone memory/memory card

    Hi All,
    I am devloping an appli in that part of an appli should read a text file stored in a phone memory or memory card .how should i give path of this file so that my appli read it.
    if any anone has sample code then please send me a link.
    Please help ASAP......
    Thanx...

  2. #2
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: Reading text file stored in phone memory/memory card

    Quote Originally Posted by devdattac View Post
    Hi All,
    I am devloping an appli in that part of an appli should read a text file stored in a phone memory or memory card .how should i give path of this file so that my appli read it.
    if any anone has sample code then please send me a link.
    Please help ASAP......
    Thanx...
    you can do your task by using File_Connection_API_(JSR_75)and set path fileconn.dir.memorycard.

    For more info..
    http://wiki.forum.nokia.com/index.ph...on_API_(JSR_75)

    Hope, It helps you.

  3. #3
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Pune
    Posts
    223

    Re: Reading text file stored in phone memory/memory card

    Thanx 4 Reply.........
    thre is problem with my code ........
    my code------------------------->

    private String readText()
    {
    try {
    FileConnection filecon = (FileConnection)Connector.open("file:///root1/latlong.txt");

    DataInputStream is = filecon.openDataInputStream();
    String fileString = is.readUTF(is);
    is.close();
    filecon.close();
    return fileString;
    } catch(IOException ioe)
    {
    System.out.println("Error!!! " +ioe);
    }
    return null;
    }

    please tell me what is the problem i got ioexception .tell me some suggetion to avoid this

  4. #4
    Registered User
    Join Date
    Feb 2007
    Location
    India
    Posts
    1,128

    Re: Reading text file stored in phone memory/memory card

    Quote Originally Posted by devdattac View Post
    Thanx 4 Reply.........
    thre is problem with my code ........
    my code------------------------->

    private String readText()
    {
    try {
    FileConnection filecon = (FileConnection)Connector.open("file:///root1/latlong.txt");

    DataInputStream is = filecon.openDataInputStream();
    String fileString = is.readUTF(is);
    is.close();
    filecon.close();
    return fileString;
    } catch(IOException ioe)
    {
    System.out.println("Error!!! " +ioe);
    }
    return null;
    }

    please tell me what is the problem i got ioexception .tell me some suggetion to avoid this
    Hi,

    I think problem with path,Check path once....file:///e:/<folder/file>name/...

    or you can try to this way....


    FileConnection fc =
    (FileConnection)Connector.open("file://localhost/" + currDirName + fileName);

    if (!fc.exists()) {
    throw new IOException("File does not exists");
    }

    InputStream fis = fc.openInputStream();
    byte[] b = new byte[1024];

    int length = fis.read(b, 0, 1024);

    fis.close();
    fc.close();
    Last edited by kis_spn; 2008-09-19 at 12:36.

  5. #5
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Pune
    Posts
    223

    Re: Reading text file stored in phone memory/memory card

    i got error message that "root is root is not accsible"
    while setting path---------
    FileConnection fc =
    (FileConnection)Connector.open("file://localhost/" + currDirName + fileName);

  6. #6
    Regular Contributor
    Join Date
    Aug 2008
    Location
    Pune
    Posts
    223

    Re: Reading text file stored in phone memory/memory card

    I am try to read file on emulator ........
    so i can give path......
    file:///root1/myfile.txt
    is it right or not?

  7. #7
    Nokia Developer Expert
    Join Date
    Jun 2005
    Posts
    923

    Re: Reading text file stored in phone memory/memory card

    "file:///root1" is not a valid root in any Nokia device. You have to specify a valid path.

    Check here for some standard allowed paths: http://www.forum.nokia.com/document/...5-94479F5BE26E

    Daniel

Similar Threads

  1. Problem while Reading text file in Nokia3650
    By lalithunt in forum Mobile Java General
    Replies: 5
    Last Post: 2008-07-30, 17:19
  2. Help ragarding reading from phone and memory card
    By prats123 in forum Mobile Java General
    Replies: 1
    Last Post: 2008-03-31, 11:00
  3. Error with makesis.exe and creating the .pkg file
    By gramya87 in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2007-10-10, 13:53
  4. reading text file from a jar file -> file not found!
    By iecomdev in forum Mobile Java General
    Replies: 1
    Last Post: 2002-09-30, 12:27

Posting Permissions

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