×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Oct 2009
    Location
    Delhi
    Posts
    124

    File reading:getting nullpointer exception

    Hi
    i am trying to read a file which is stored in my memory card inside a directory...but every time i am getting nullpointer exception i have pasted my code here...pls check it...
    byte[] mob;
    try{
    fconn=(FileConnection)Connector.open("file:///E:/My Files/Bejoy.txt",Connector.READ_WRITE);
    inData=fconn.openDataInputStream();
    inData.read(mob);
    inData.close();
    }catch(Exception e){
    e.printStackTrace();
    }
    append(new StringItem("Mobile No:",mob.toString()));
    Last edited by bejoy_ak; 2010-04-15 at 15:48.

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: File reading:getting nullpointer exception

    Try to RUN PDAPDemo of SUN WTK on your device and see if you can see this file in the file system.
    And also check, if your target device support JSR-75 FCA API's and you have signed the app.

    thanks,
    ~Amitabh

  3. #3
    Registered User
    Join Date
    Oct 2009
    Location
    Delhi
    Posts
    124

    Re: File reading:getting nullpointer exception

    target device is nokia 6303 classic it has cldc1.1 and midp2.1..it supports jsr-75...

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: File reading:getting nullpointer exception

    Then the problem will be of path or signing the Midlet.

    Check the path by runing - PDAPDemo of WTK.

    thanks,
    ~Amitabh

  5. #5
    Registered User
    Join Date
    Oct 2009
    Location
    Delhi
    Posts
    124

    Re: File reading:getting nullpointer exception

    i tried the PDAP Demo..wen i tried to view some of the pictures its showing some characters only..so the solution is to sign the midlet...or is there any other solution for this...

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: File reading:getting nullpointer exception

    How are you trying to display the Pictures where you see characters only ?

    This means that you find the right path is able to access the txt file ?

    thanks,
    ~Amitabh

  7. #7
    Registered User
    Join Date
    Oct 2009
    Location
    Delhi
    Posts
    124

    Re: File reading:getting nullpointer exception

    i got the characters when i tried the PDAP Demo..i used tat app to view pictures..then it is showing some characters instead of picture..but i was able to view the text files correctly...

  8. #8
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: File reading:getting nullpointer exception

    then it is showing some characters instead of picture..but i was able to view the text files correctly...
    So now you fix your program to read "file:///E:/My Files/Bejoy.txt" looking into the correct path of this file from PDAPDemo.
    And in case of Imagefile, you can't convert bytes to string and see... use createImage() from Bytes and then you can display the image on device.

    thanks,
    ~Amitabh


    thanks,
    ~Amitabh

  9. #9
    Registered User
    Join Date
    Oct 2009
    Location
    Delhi
    Posts
    124

    Re: File reading:getting nullpointer exception

    thanks Amitabh for ur help..nw i am able to readd the text file and jpg file from the memory card....

Similar Threads

  1. Carbide Build PKG file to SISX - Phone says: "Can't Install"
    By mikedeklerk in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 6
    Last Post: 2009-05-19, 08:23
  2. MBM image is not found
    By tamhanna in forum Symbian
    Replies: 14
    Last Post: 2009-04-20, 12:44
  3. VS.Net 2003 Carbide 2.01 and epoc32.exe
    By ValentinK in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2007-01-12, 12:31
  4. S60 theme questions
    By Nokian_Spb in forum Symbian Media (Closed)
    Replies: 3
    Last Post: 2006-08-17, 06:11
  5. can not successfully link any sample using .NET
    By lobotomat in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2002-08-20, 00:29

Posting Permissions

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