title: Create a TXT File in SD Card and write into it in android not working
body: <pre><code>String fileName = "sample";
  try {
       final File f= new File(Environment.getExternalStorageDirectory(), fileName);
       FileOutputStream fo = new FileOutputStream(f);
       fo.write(code.getBytes());
       fo.close();
       Toast.makeText(getBaseContext(),"Done writing SD 'mysdfile.txt'",
                 Toast.LENGTH_SHORT).show();
      } catch (FileNotFoundException e) {
           Toast.makeText(getBaseContext(), e.getMessage(),
                  Toast.LENGTH_SHORT).show();
      } catch (IOException e) {
           Toast.makeText(getBaseContext(), e.getMessage(),
                  Toast.LENGTH_SHORT).show();
      }
  </code></pre>
  
  <p>I need to copy a String named <code>code</code> to my file named <code>sample</code>. </p>
  
  <p>If I do this, I  don't get any errors. However, if use my phone and debug into my SD card, no File is created. Can anyone please tell me what I have done wrong??</p>