0

I have 5 uicontrols, custom ui that i have written by extending views. All of them support gestures, i want to write the timestamp of each gesture from each ui to a file. The file will be created at runtime on the sdcard.

I have created a singleton object - its instantiated in each ui view. I am passing in the timestamp each time there is a gesture on the view (views have gestures like zoom/pan etc).

So how do i write these timestamps to a file that i created in the singleton object.

Archie
  • 161
  • 1
  • 8

2 Answers2

0

You can use your Singleton object and get the timestamps and put them in a queue; then you can de-queue timestamps and write them to your file!

gst
  • 828
  • 5
  • 15
0

You can use java.nio.channels.FileChannel do synchronized writing to a file.

Take a look at this the following post for an example implementation.

Write to FileOutputStream from multiple threads in Java

Community
  • 1
  • 1
Akos Cz
  • 12,711
  • 1
  • 37
  • 32