• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to write float values from accelerometer to a file  RSS feed

 
Greenhorn
Posts: 27
  • 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.

 
Saloon Keeper
Posts: 4191
101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try to flush and/or close the file.
 
ravindra koranga
Greenhorn
Posts: 27
  • 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.
 
Master Rancher
Posts: 2586
30
  • 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: 27
  • 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


 
Sheriff
Posts: 23137
45
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
Master Rancher
Posts: 2586
30
  • 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: 27
  • 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
Boost this thread!