I seemingly have something wrong with my code as I keep getting a null
pointer problem.
Here is the code:
private BufferedWriter GPS_File = null;
private static final String GPS_File_String = "gps-data.recent";
GPS_File = getFileConn(GPS_File_String);
Log.d(TAG, "opened file 'gps-data.recent' for
writing");
private static BufferedWriter getFileConn(String fileName)
{
BufferedWriter bw = null;
try
{
bw = new BufferedWriter(new FileWriter(fileName));
}
catch (IOException e)
{
System.out.println("Error making arff file: " +
e.getMessage() );
System.exit(0);
}
return bw;
} //end getFileConn
GPS_Timer.scheduleAtFixedRate(new TimerTask() {
public void run()
{
if (GPS_CHECK == true)
updateGPSfile();
Log.d(TAG, "timer action!");
}
}, 0, GPS_SAMPLE_RATE);
private void updateGPSfile(){
if (Email.length() < 1)
Email = "Anonymous";
StringBuilder gpsStr = new StringBuilder();
gpsStr.append(Email).append(",").append(Activity_Type).append(",")
.append(GPS_Values[0]).append(",").append(GPS_Values[1]).append(
",").append(GPS_Values[2]).append("\r\n");
try{
GPS_File.write(gpsStr.toString());
GPS_File.flush();
} catch (IOException e){
e.printStackTrace();
}
}
the values associate on the StringBuilder is: email, No Label, null,
null, null --> according to stack trace
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en