title: How to create files to a specific folder in android application?
body: <p>In my application, I want to create a text file in the cache folder and first what I do is create a folder in the cache directory.</p>
  
  <pre><code>File myDir = new File(getCacheDir(), "MySecretFolder");
  myDir.mkdir();
  </code></pre>
  
  <p>Then I want to create a text file in that created folder using the following code that doesn't seem to make it there. Instead, the code below creates the text file in the "files" folder that is in the same directory as the "cache" folder.</p>
  
  <pre><code>FileOutputStream fOut = null;
              try {
                  fOut = openFileOutput("secret.txt",MODE_PRIVATE);
              } catch (FileNotFoundException e) {
                  e.printStackTrace();
              }
              String str = "data";
              try {
                  fOut.write(str.getBytes());
              } catch (IOException e) {
                  e.printStackTrace();
              }
              try {
                  fOut.close();
              } catch (IOException e) {
                  e.printStackTrace();
              }
  </code></pre>
  
  <p>SO my question is, how do I properly designate the "MySecretFolder" to make the text file in?</p>
  
  <p>I have tried the following:</p>
  
  <p><strong>"/data/data/com.example.myandroid.cuecards/cache/MySecretFolder"</strong>, but it crashes my entire app if I try that. How should I properly save the text file in the <strong>cache/MySecretFolder</strong>?</p>