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. Do the applications keep/manage their own SQLite databases (files)?

You can create, update and delete your application database in your
to start.

On Aug 25, 2:08am, "" <>


2. Multiple colors for a textview

Can any one help me......

How to give multiple colors for a textview .

1. Don't use HTML.
2. ex:- sample

in this i need
 sa as red color
 mp as blue
 le as green color

Thanks in advance..........

suggess me ...........

3. Needed reference to source code for adb shell command "input" that is used to inject keypresses.

4. Is there a way to control the Android phone or do a automated test using a remote PC?

5. "Enter" Key Virtual Keyboard

6. Motorola Android Devices Coming Sept. 10

7. hi, I'm the nre comer