Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to write float values from accelerometer to a file

 
ravindra koranga
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wish to log data accelerometer onto a file in the form of float values. I tried following:



In this code the file is created in the internal storage but there is no data written to it. File is created with zero size. Why does this happen? Please help.

 
Tim Moores
Bartender
Posts: 3134
50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to flush and/or close the file.
 
ravindra koranga
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try {
            fOut.close();
     } catch (IOException e)
     {

     }
//I tried this after calling save function.It does not help.
 
Norm Radder
Bartender
Posts: 1526
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where is the catch block that belongs to the try on line 17?   Are exceptions being ignored?
 
ravindra koranga
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually I have cropped the code. The try block has on more statement at the last


So full code goes lik this


 
Paul Clapham
Sheriff
Posts: 21572
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have evidence that the save() method is actually called?
 
Norm Radder
Bartender
Posts: 1526
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add a Toast to onSensorChanged() to see if it is called.
 
ravindra koranga
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. I added a Toast before and after save function. That shows save fun is called. Also onSensorChanged() is called too.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic