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. How to do a fade of views mostly radio buttons

Hi i created my own radio button so basically it will deselect when u
click it again if its already toggled on. my main question is if
anyone knows like if u have a radio group and 3 radio buttons I select
the top one and i want the other 2 to be faded? like its still there
visible but is like either slanted or shaded in a way so the user cant
select them and its obvious that the user wouldnt be able to so i
would need to know how to turn off the one click listerner function or
shade it away like a button


2. Digest for - 25 Messages in 12 Topics

22.03.2011 0:59, Waleed Basheer :
Thanks guys, adding that ListView with id="@android:id/list" did the trick. I have another layout question that hopefully you guys can answer, I created a RelativeLayout in XML and want to use this layout inside another XML layout but am not sure how to call/use it. I know how to use a Layout created programmatically inside an XML layout file (<com.package.Layout ....>) but am unsure how to do it using one created as an XML layout. Anybody know how?
I *think* you're looking for this: -- Kostya Vasilyev -- --

3. Is there support in Android for virtual serial ports ?

4. mediaplayer surface initialized to a frame

5. Dialog, TabView

6. using the keytool for getting google-maps-API-key returns unrecognized option error

7. Attempt to read preferences file without permission