×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    24

    File connection path

    I want to perform file operation in s40 series,i want to write few data in a file in device and i want to read that file. I don't know how to specify the path in emulator and device for both read and write operation. please somebody help me.

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2011
    Posts
    555

    Re: File connection path

    Hi prakashohile,

    Regarding read operations, you can examine the ImageViewer example. This example attempts to display and open image files located on the device's file system. It also works with a Series 40 SDK, by using the virtual storage system. If for example you import the project to Nokia SDK 1.1 for Java, you can copy a medium sized .jpg file to the following path:
    C:\Nokia\Devices\Nokia_SDK_1_1_Java\bin\storage\1100\C\predefgallery\predefphotos

    When launching the MIDlet, you should be able to see the saved image, listed on the Emulator and by tapping you can display it on the screen.

    You can use these system properties in order to retrieve the URL for the default directories for images, videos etc.

    For write operations and more code snippets make sure to check the FileConnection API as well as this wiki article.

  3. #3
    Registered User
    Join Date
    Jun 2011
    Posts
    24

    Re: File connection path

    sorry i am not clear.please give some more examples and explanation.I cant able to perform read operation.These are my read operation code

    public String file()
    {
    InputStream is = getClass().getResourceAsStream("mytext.txt");
    System.out.println("outsream = "+is);
    StringBuffer sb = new StringBuffer();
    try{
    int chars, i = 0;
    while ((chars = is.read()) != -1){
    sb.append((char) chars);
    }
    return sb.toString();
    }catch (Exception e){}
    return null;
    }

    the outsream value printed null.but in "C:\Nokia\Devices\S40_6th_Edition_SDK_FP1\bin\Storage\6700001\C\predefgallery" i have the file like mytext with few datas.
    Last edited by prakashohile; 2012-05-07 at 08:44.

  4. #4
    Registered User
    Join Date
    Mar 2003
    Posts
    4,105

    Re: File connection path

    If the user should be able to move that file, you use the FileConnection API of JSR-75.
    If the file is read-only, you include the file in your JAR and use getClass().getResourceAsStream
    If the file is actually just some media data, you use the RecordStore API of MIDP.

Similar Threads

  1. Path for File Connection
    By devdattac in forum Mobile Java General
    Replies: 9
    Last Post: 2008-10-15, 14:12
  2. where the file in app path
    By billqu in forum Symbian
    Replies: 0
    Last Post: 2008-03-19, 11:29
  3. File Connection path problem
    By javadev2 in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2007-10-30, 17:52
  4. While imprting an mmp file, Carbide doesn't always honor the user include file path
    By svdwal in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2006-12-04, 19:42
  5. File path
    By vodkaloon in forum Symbian
    Replies: 0
    Last Post: 2005-01-07, 16:15

Posting Permissions

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