title: Continuously writing to a text file in Android
body: <p>I understand this question has probably been asked many times before, but I cannot find an example that caters towards my needs. I have asked questions on StackOverflow a few times before, and there are occasionally gents who ask me to "go read a book" or "do some research" before asking for help here. Well, I have done that, and I didn't find enough information - so if you're one of those people, I would really appreciate it if you could point me to a resource so I know where to dig.</p>
  
  <p>Anyway, I finally finished writing an application that calculates bandwidth, link speed, and other attributes of the device. The bandwidth gets refreshed every 5 seconds, and the link speed and data connection refreshes every second. Currently, the information is displayed on the screen.</p>
  
  <p>I'm trying to create a greater-schemed project that involves another computer (a command center) monitoring the connectivity of the device, and to do this, the device has to save these values to a text file that can be SSH'd by the command center. This question is trivial; how do I go about writing data to a text file? I know how to do this in Java; I could use FileOutputStream, or combine FileWriter + PrintWriter to achieve a similar effect. However, I don't know how directories work in Android, and I'm not sure whether there are any precautions I should be aware of while writing to files in Android. I notice that I need to state something like:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  </code></pre>
  
  <p>in the manifest. Is there anything else that I should be doing? Also, for my needs, can anyone recommend a way to write to the output effectively? Is FileOutputStream the way to go, as it seems to be fairly easy? Should I tokenize my data a specific way, such as splitting it with a tab? I'm new to programming and I'm still learning, but I would appreciate some help or recommendations of useful readings.</p>
  
  <p><a href="http://developer.android.com/intl/zh-tw/training/basics/data-storage/files.html" rel="nofollow">This website</a>, which is presumably the go-to reading, is currently down. If anyone could provide me some snippets of examples, it would be greatly appreciated.</p>