Display a saved PDF file
<p>I've successfully saved the file to the directory I specified in the SD card. The pdf automatically prompts for either Adobe pdf Viewer or Quickoffice (correctly). However when the file tries to open I get that the file is not a valid PDF. I know this has to do with the fact I am not writing the file to the card correctly, and some data is left out. Any help fixing that part? Thank you in advance. Here is my full code, the beginning section is where the file is downloaded to the SD card. </p>

<p><pre>
public class Open extends ListActivity {</p>

<p>private List item = null;
 private List path = null;
 private String root="/sdcard/storage";
 private TextView myPath;</p>

<p>String filename = "Leading";<br>
 File file = new File(root, filename);
 FileOutputStream fos;<br>
 byte[] data = new String("R.raw.leading.pdf").getBytes();{</p>

<p>try {
     fos = new FileOutputStream(file);
     fos.write(data);
     fos.flush();
     fos.close();</p>

<p>} catch (FileNotFoundException e) {
     // handle exception
 } catch (IOException e) {
     // handle exception</p>

<p>}</p>

<code> }
</code></pre>

<p></p>
