On Fri, Jul 30, 2010 at 9:26 AM, Dson <[email protected]> wrote: > Hi Guys, > > I am trying to get the last modified date of an internal file and it > always returns me 0 although I could read the file properly. Can you > please let me know if I am doing anything wrong... > > Creating a file... > -------------------- > > FileOutputStream Os = activity.openFileOutput("file1.jpg", > Context.MODE_PRIVATE); > cachedImage.compress(CompressFormat.JPEG, 75, Os); > Os.close(); > > > Reading the file... > -------------------- > long mod_time = 0; > File file = new File("file1".jpg"); > mod_time = file.lastModified(); > FileInputStream Is = activity.openFileInput("file1.jpg"); > cachedImage = BitmapFactory.decodeStream(Is); > Is.close(); > > > **mod_time is always zero!!!!**
That is because you are looking at the wrong file. Use new File(getFilesDir(), "file1.jpg") to get at the same file that you use with openFileInput()/openFileOutput(). -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

