×

Discussion Board

Page 1 of 3 123 LastLast
Results 1 to 15 of 32
  1. #1
    Regular Contributor
    Join Date
    May 2010
    Posts
    94

    Creating and saving text file in Phone Memory.

    Dear Guys,
    I have made a Application and As a database using Txt file.

    When I install and Run the application on the Phone then It run successfully if the Phone have Memory Card.

    But If Phone does not have Memory card then It show the Null Pointer Exception.

    What can i do.

  2. #2
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Creating and saving text file in Phone Memory.

    Quote Originally Posted by nitinverma274 View Post
    Dear Guys,
    I have made a Application and As a database using Txt file.

    When I install and Run the application on the Phone then It run successfully if the Phone have Memory Card.

    But If Phone does not have Memory card then It show the Null Pointer Exception.

    What can i do.
    You might have hard coded the path of the file you are trying to save to memory card thats why its happening like this.

    refer to :

    http://wiki.forum.nokia.com/index.ph...ile_in_Java_ME
    http://wiki.forum.nokia.com/index.ph...ems_in_Java_ME
    http://wiki.forum.nokia.com/index.ph...ers_in_Java_ME
    Thanks,
    Ekta

  3. #3
    Regular Contributor
    Join Date
    May 2010
    Posts
    94

    Re: Creating and saving text file in Phone Memory.

    Ekta. I am not Understanding what u want to say?.

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

    Re: Creating and saving text file in Phone Memory.

    You have to check that is memory card exists or not.
    Please check the link related:
    http://discussion.forum.nokia.com/fo...to-memory-card

    Also you can check the FileSystemRegistry.listRoots will give all the drives on device.
    thanks,
    jitu_goldie..

    KEEP TRYING..

  5. #5
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Creating and saving text file in Phone Memory.

    Quote Originally Posted by nitinverma274 View Post
    Ekta. I am not Understanding what u want to say?.
    You need the path of the file in phone memory as such a place your application is allowed to write data.
    If you are trying to always save file in memory card, even when memory card does not exist it will create a problem.
    So first check if the memory card exist or not, then try writing to it.... if it does not write to phone memory - public folder like photo's etc and check.
    refer to -- http://wiki.forum.nokia.com/index.ph...ems_in_Java_ME

    You are trying on which device ?
    Thanks,
    Ekta

  6. #6
    Regular Contributor
    Join Date
    May 2010
    Posts
    94

    Re: Creating and saving text file in Phone Memory.

    U r not understanding what I want to say.
    My Phone does not have memory card.
    So How can i use Phone memory.
    I am using this.

    Enumeration drives = FileSystemRegistry.listRoots();
    String root=null;
    while(drives.hasMoreElements())
    {
    root = (String) drives.nextElement();
    }
    //root = (String) drives.nextElement();
    path = "file:///" + root;
    path=path+"rsstitles.txt";


    I am using Nokia 6301.

  7. #7
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Creating and saving text file in Phone Memory.

    Quote Originally Posted by nitinverma274 View Post
    U r not understanding what I want to say.
    My Phone does not have memory card.
    So How can i use Phone memory.
    I am using this.

    Enumeration drives = FileSystemRegistry.listRoots();
    String root=null;
    while(drives.hasMoreElements())
    {
    root = (String) drives.nextElement();
    }
    //root = (String) drives.nextElement();
    path = "file:///" + root;
    path=path+"rsstitles.txt";


    I am using Nokia 6301.
    Problem lies here --- path = "file:///" + root;
    path=path+"rsstitles.txt";


    You do not have access to write to filesystem Root on memory card..
    try to write in photo or images or gallary

    try String path = System.getProperty("fileconn.dir.photos");
    path=path+"rsstitles.txt";
    Thanks,
    Ekta

  8. #8
    Regular Contributor
    Join Date
    May 2010
    Posts
    94

    Re: Creating and saving text file in Phone Memory.

    U mean I should use Like This,
    path = "file:///photo/" + root;
    path=path+"rsstitles.txt";

    OR

    path = "file:///images/" + root;
    path=path+"rsstitles.txt";

  9. #9
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Creating and saving text file in Phone Memory.

    Quote Originally Posted by nitinverma274 View Post
    U mean I should use Like This,
    path = "file:///photo/" + root;
    path=path+"rsstitles.txt";

    OR

    path = "file:///images/" + root;
    path=path+"rsstitles.txt";
    Use this:
    try String path = System.getProperty("fileconn.dir.photos");
    path=path+"rsstitles.txt";


    don't add root..... no need.
    Thanks,
    Ekta

  10. #10
    Regular Contributor
    Join Date
    May 2010
    Posts
    94

    Re: Creating and saving text file in Phone Memory.

    I am Trying this. But can U tell me about "fileconn.dir.photos". fileconn is what.

  11. #11
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Creating and saving text file in Phone Memory.

    Quote Originally Posted by nitinverma274 View Post
    I am Trying this. But can U tell me about "fileconn.dir.photos". fileconn is what.
    The Gallery folders can be accessed by using system properties, for example: System.getProperty("fileconn.dir.photos")

    Your application might have access to read/write data on this folder thats why I suggested it.
    Thanks,
    Ekta

  12. #12
    Regular Contributor
    Join Date
    May 2010
    Posts
    94

    Re: Creating and saving text file in Phone Memory.

    Ekta, Still I have Same Problem.

  13. #13
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Creating and saving text file in Phone Memory.

    Quote Originally Posted by nitinverma274 View Post
    Ekta, Still I have Same Problem.
    What value you get for this - System.getProperty("fileconn.dir.photos");

    What error/exception you are getting when you try to write your file at this path ?
    Thanks,
    Ekta

  14. #14
    Regular Contributor
    Join Date
    May 2010
    Posts
    94

    Re: Creating and saving text file in Phone Memory.

    Quote Originally Posted by ektasrv View Post
    What value you get for this - System.getProperty("fileconn.dir.photos");

    What error/exception you are getting when you try to write your file at this path ?
    I am getting from this System.getProperty("fileconn.dir.photos");
    file:///root1/

    and the Error when I run application on the Phone is
    nullpointer Exception.

  15. #15
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Creating and saving text file in Phone Memory.

    Quote Originally Posted by nitinverma274 View Post
    I am getting from this System.getProperty("fileconn.dir.photos");
    file:///root1/

    and the Error when I run application on the Phone is
    nullpointer Exception.
    Thats the problem, it should be -- file:///c:/data/Images/
    in S40.
    Try this hardcoded.

    Also Refer to: http://www.forum.nokia.com/document/...79F5BE26E.html

    for details of these properties.
    Thanks,
    Ekta

Similar Threads

  1. Reading text file stored in phone memory/memory card
    By devdattac in forum Mobile Java General
    Replies: 6
    Last Post: 2008-09-19, 19:30
  2. saving a text in a file written in text editor
    By vineet.jain in forum Symbian
    Replies: 1
    Last Post: 2008-07-04, 14:12
  3. Saving an image to phone memory
    By dakz in forum Mobile Java General
    Replies: 6
    Last Post: 2007-04-12, 15:08
  4. saving and loading images from phone memory
    By alid in forum Mobile Java General
    Replies: 1
    Last Post: 2006-08-16, 19:29
  5. Saving MMS in the phone memory
    By ashishga in forum Mobile Java General
    Replies: 0
    Last Post: 2006-01-27, 05:07

Posting Permissions

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