title: Writing a file to sdcard
body: <p>I'm trying to write a file from an Http post reply to a file on the <strong><em>sdcard</em></strong>. Everything works fine until the byte array of data is retrieved.</p>
  
  <p>I've tried setting <code>WRITE_EXTERNAL_STORAGE</code> permission in the manifest
  and tried many different combinations of tutorials I found on the net.</p>
  
  <p>All I could find was using the <code>openFileOutput("",MODE_WORLD_READABLE)</code> method, of the activity but how my app writes file is by using a thread. Specifically, a thread is invoked from another thread when a file has to be written,
  so giving an activity object didn't work even though I tried it.</p>
  
  <p>The app has come a long way and I cannot change how the app is currently written.</p>
  
  <p>Please, someone help me?</p>
  
  <hr>
  
  <p><strong>CODE</strong>:</p>
  
  <pre><code>File file = new File(bgdmanip.savLocation);
  FileOutputStream filecon = null;
  filecon = new FileOutputStream(file);
  
  byte[] myByte;
  myByte = Base64Coder.decode(seReply);
  
  bos.write(myByte);
  filecon.write(myByte);
  myvals = x * 11024;
  </code></pre>
  
  <p><code>bgdmanip.savLocation</code> holds the whole files path. <code>seReply</code> is a string reply from <code>HttpPost</code> response. The second set of code is looped with reference to <code>x</code>. The file is created but remains 0 bytes.</p>