private file last modified date

by Dson » Sun, 01 Aug 2010 13:06:35 GMT

Sponsored Links
 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",
cachedImage.compress(CompressFormat.JPEG, 75, Os);

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);

**mod_time is always zero!!!!**


private file last modified date

by Mark Murphy » Sun, 01 Aug 2010 14:53:33 GMT


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)  |  | 

Android Training...At Your Office: 


Sponsored Links

Other Threads

1. Application as a broadcast receiver

 If  I am broadcasting an Intent from an activity
Can we make another application as a that it will get
invoked when that specific intent is broadcasted.

2. Android rss reader


I am currently developing an RSS reader but can't seem to read any
google news rss. I was wondering if their servers blocked any android
app trying to read the feed. (Yahoo rss work fine)
Does anyone know anything about this ?



3. Folder under raw or drawable

4. Suggestion for placing buttons

5. how to avoid activity restart at keyboard open or close

6. how to avoid activity restart at keyboard open or close

7. Protocol Stack