file reading problem

Put your problem here if it does not fit any of the other categories.

file reading problem

Postby vallis » Fri Oct 31, 2008 1:49 pm

Hi all,
I'm having another strange problem with my app.
I'm using flat files to store incoming SMS messages and reading them back in a ListView.
The basics of the method are as follows

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.         String[] SMSlist = new String[fileList.length];
  3.  
  4.         while(pointer < fileList.length)
  5.  
  6.         {
  7.  
  8.                 try
  9.  
  10.                 {
  11.  
  12.                     add some data from the file to SMSlist[pointer]
  13.  
  14.                 }
  15.  
  16.                 catch (Exception FileNotFoundException)
  17.  
  18.               {
  19.  
  20.                 Log.e(TAG, "File not found exception: " + fileList[pointer]);
  21.  
  22.               }
  23.  
  24.                 pointer++;
  25.  
  26.         }
  27.  
  28.  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4


Everything works fine as long as the only files in the data directory are the SMS files created by my broadcastReceiver. If I add another file to that directory, either through the app itself or by copying a file over with ddms, I get
10-31 12:28:35.511: ERROR/AndroidRuntime(6082): Uncaught handler: thread main exiting due to uncaught exception
10-31 12:28:35.531: ERROR/AndroidRuntime(6082): java.lang.NullPointerException


I've tried catching NullPointerException as well as file not found but it doesn't make a difference.
Can anyone shed any light on what I'm doing wrong?

Thanks in advance
Cheers,
V.
vallis
Junior Developer
Junior Developer
 
Posts: 23
Joined: Sat Oct 11, 2008 12:52 pm
Location: Scotland

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 22 guests