title: Private folder on Internal/external storage on android
body: <p>I want to create a private folder for my app data. This folder has to be deleted automatically when the app is removed from the device. According to <a href="http://developer.android.com/training/basics/data-storage/files.html" rel="noreferrer">http://developer.android.com/training/basics/data-storage/files.html</a>, I have to create a private folder. How can I achieve this. My code below. Folder is not deleted when the app is removed. </p>
  
  <pre><code> public static String getAppFilePath(Context context) {
  
          String path = "";
          if (Environment.getExternalStorageState().equals(
                  Environment.MEDIA_MOUNTED)) {
              path = Environment.getExternalStorageDirectory()
                      .getAbsolutePath();
  
              path += "/myFolder";
  
          } else {
  
              ContextWrapper c = new ContextWrapper(context);
              path = c.getFilesDir().getPath();
          }
          File ret = new File(path);
          if (!ret.exists()) {
              ret.mkdirs();
          }
          return path;
      }
  </code></pre>