getCacheDir() not working

by DanaH » Mon, 07 Dec 2009 13:54:52 GMT

Sponsored Links
 I am attempting to follow a code snipet for saving a file to a cache
directory without success.

    File pathCacheDir = getCacheDir();
    System.out.println("Got the Cache directory");
    File newCacheFile = new File(pathCacheDir, cacheFileName);
    FileOutputStream stream = new FileOutputStream
    tileImage.getBitmap().compress(CompressFormat.PNG, 100, stream);
}catch(Exception e) {
    Log.v(TAG, "Not able to save tile to Cache...");

The first debug statement that prints out is in the caught exception,
which tells me that the getCacheDir() call is where the failure
occured. Upon doing further investigation, I found that the /data/data/
<package name>/cache/ file does not exist by examining the file
structure in the DDMS.
Should the cache dir be a pre-existing directory? In any case, I have
since been able to created it explicitly. However, the program is
still failing at the same getCacheDir() call.
Is this likely a bug in the SDK, or am I missing some key information?


Other Threads

1. How to load applications on Android Dev Phone??

Hello, I just received an Android Dev Phone and there is not much
documentation around about it. Does anyone of you know how to load
apps directly on the phone, how to mount the phone filesystem (not the
SD card), etc? I'm a bit lost in this issue. Any help would be
appreciated. Thank you.


2. Google go shakehands with mabile phone makers!!!!!

IMO, Google should not have partnered with HTC but those vendors who
make powerful but cheap chipsets/parts for China piratic phones, clone
phones, robber phones or so-called "mabile" phones, eg. Taiwan
MediaXXXX as a leader in the "industry".

With only 1/2-1/4 price of OEM phones, mabile phones boosted sales to
nearly 200M handsets and $Bs.

One year of 200M could put IPhone to dust and make many Android
developers millionares!!

Folks, second me! Don't bash me!!


3. Keeping GUI Updated

4. 鈽匴hat is the plan about Camera and MediaRecorder?

5. Smack API and Android

6. Embeded APK?

7. Bluetooth Scan invocation...