开发者

android: How can I check package to be assured that is a file exist?

In my project I have a Picture that through program, I extracted pixels, manipulate those pixels and then sa开发者_如何学Cved it in my package

FileOutputStream fos = new FileOutputStream(context.getFilesDir().getAbsolutePath() + "/newPicture.bmp");

so, it saves my picture in

/data/data/my_package_name/files

Now, I want to replace my default picture with this new picture. Actually, since I don't have this new picture, default picture should be shown. when new picture prepared, default picture should be replace with new one.

my main problem is How can I check to be assured that is new picture exist? if not exist show default picture, if exist show new picture.

Thanks.


Write a service in android that will monitor your old file whether any update has happened. If there is change in timestamp for the file, then new file has been updated.Get this status from your other Activity or View class before you are performing the file operations. Hope this will help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜