title: Get the cache directory of another application
body: <p>I'm working on an Android App where I list the path and the size of the cache directory of all apps.
  I have written a bit of the code already but now it crashes and i don't know whats wrong.</p>
  
  <pre><code>Context context = createPackageContext(p.applicationInfo.packageName, Context.CONTEXT_INCLUDE_CODE);
  items.add(p.applicationInfo.loadLabel(getPackageManager()).toString() + ": " + context.getCacheDir().getName());
  </code></pre>
  
  <p>p is the PackageInfo of the File and items is an ArrayList.
  A NullPointerException causes the crash.
  I hope someone can help me!</p>
  
  <p><strong>EDIT:
  Here is the LogCat:</strong></p>
  
  <pre><code>12-15 02:34:14.507: W/dalvikvm(10789): threadid=1: thread exiting with uncaught exception (group=0x40e34300)
  12-15 02:34:14.511: E/AndroidRuntime(10789): FATAL EXCEPTION: main
  12-15 02:34:14.511: E/AndroidRuntime(10789): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.alexnavratil.test/com.alexnavratil.test.MainActivity}: java.lang.SecurityException: Requesting code from app.test.com (with uid 10075) to be run in process com.alexnavratil.test (with uid 10104)
  </code></pre>
  
  <p>I hope this is enough. The full LogCat is very long.</p>