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. G1

Thanks for making the first phone only available to those people with
T-Mobile. I am so glad I have been waiting a year to see all the
people with T-Mobile get a phone.... Just to wait more.

2. Hessian Web Service and Android App

I have build a simple tapestry web application and set up hessian web
service within the servlet and when I access it from pc client it
works fine.

I want to access this service using hessian on Android but I can't
find a proper way to include hessian library(and any other third party
jar) in eclipse project so that it works during runtime. I have
browsed the web for like 2 last weeks, and googled and googled but all
solutions that I found were just not working! :(

Please Help!

I know this is basic stuff, and 90% of you guys know how to do this,
so help please :)
So my basic question is:

How to properly include third party jar in my android application so
that it works not only during compile time but also during runtime :)
Awaiting response eagerly :)

3. Cupcake's bug ? Caused by: android.content.res.Resources

4. How the video display size making use of resize and rotation is set under Android

5. Updating cupcake Images to Android Developer Phone

6. using internal media provider

7. Basic HTTP authentication