I am fetching the gps location once in half an hour and displaying it in textview also saving the values passed in textview to sdcard gpsdata.txt file, using the below code but here i have to save it with time and date and also numbered.
- Now i get gps location like this in txt file :
13.01471695,80.1469223 13.01471695,
80.1469223 13.01471695,80.1469223
13.01471695,80.1469223
- But i need like this:
1)13.01471695,80.1469223 time:12 30pm date:1/1/2013
2)13.01471670,80.1469260 time:12 45pm date:1/1/2013
public void appendData(String text)
{
File dataFile = new File(Environment.getExternalStorageDirectory() + "/SUNDTH/GpsData.txt");
if (!dataFile.exists())
{
try
{
dataFile.createNewFile();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
try
{
//BufferedWriter for performance, true to set append to file flag
BufferedWriter buf = new BufferedWriter(new FileWriter(dataFile, true));
buf.append(text);
buf.newLine();
buf.close();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
}
thank you.