×

Discussion Board

Results 1 to 4 of 4

Thread: Read TXT File

  1. #1
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    50

    Read TXT File to a ChoiceGroup

    Hi,

    Can I read a txt file outside JAR File? How?
    Could give me an example?

    If possible give me example of how to read outside JAR file (if it is possible, of course) and inside JAR file.


    I try to use BufferedReader, but it is not recognised.

    What I really want to do is read lines of a txt file and place them in a ChoiceGroup Item.

    For example I have this txt file:
    Code:
    myTxt.txt
    
    10
    20
    30
    Then in my mobile application I want that lines appears as a ChoiceGroup for the user.

    Any help would be great...



    Thanks
    decisor
    Last edited by decisor; 2006-06-27 at 15:51.

  2. #2
    Super Contributor
    Join Date
    Mar 2006
    Posts
    516

    Re: Read TXT File

    Hi,

    if ur device supports JSR - 75 then u will be able to read it using fileconnection.
    Here is a documentation of how to use fileconnection
    http://www.forum.nokia.com/info/sw.n..._v1_1.zip.html

    Regarding jar file here is an example
    http://discussion.forum.nokia.com/fo...ad.php?t=39685

    Wang

  3. #3
    Regular Contributor
    Join Date
    Jun 2006
    Posts
    50

    Re: Read TXT File

    Thanks wang_shui,

    but....

    How can I read the returned string to make a choicegroup with lines present in txt file?


    decisor

  4. #4
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,699

    Re: Read TXT File

    hi decisor,

    because you don't have advanced sdk string utils you can rely simply on String class methods,
    see that thread:
    http://forum.java.sun.com/thread.jsp...hreadID=646861
    for sample on how to parse text data into array (that is after you read resource file),
    also consider using simpler data format (use some separator like | isntead of newlines chars which can confuse your code at runtime (you can have different newline chars depending on system and text editor),

    hth,
    regards,
    peter

Similar Threads

  1. read text file
    By ivan6502 in forum Mobile Java General
    Replies: 1
    Last Post: 2005-01-17, 21:10
  2. write and read a TInt data from the file
    By billqu in forum Symbian C++
    Replies: 2
    Last Post: 2004-12-27, 15:10
  3. Help me read a text file
    By margaretpoor in forum Symbian C++
    Replies: 1
    Last Post: 2004-05-24, 04:08
  4. read file and display contents
    By sajindra in forum Symbian C++
    Replies: 0
    Last Post: 2004-05-16, 18:55
  5. What's the extension of the file to be read in?
    By da01643 in forum Symbian C++
    Replies: 4
    Last Post: 2003-10-05, 10:42

Posting Permissions

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