Whenever a new photo is created (i.e. a new photo is clicked from a camera intent) in the directory I am monitoring, the onEvent
method first catches the FileObserver.CREATE
event, and immediately after that, it catches FileObserver.MODIFY
event. Why is it catching the FileObserver.MODIFY
event? Is it some sort of bug, or it always happens like this?
Asked
Active
Viewed 71 times
0

Preetom Saha Arko
- 2,588
- 4
- 21
- 37
-
when the file is created it has the length of zero – pskink Jan 27 '18 at 14:11
-
So whenever a new photo is created, both of these events will be triggered one by one, right? @pskink – Preetom Saha Arko Jan 27 '18 at 14:18
-
i think it is quite normal way... otherwise what would `CREATE` be used for? – pskink Jan 27 '18 at 14:19
-
When FileObserver.CREATE event is caught, the size of the file is not zero, as suggested by the debugger. @pskink – Preetom Saha Arko Jan 27 '18 at 14:26
-
FileObserver works in async way so the notification can be delayed i think – pskink Jan 27 '18 at 14:28