title: How to write an array to a text file on internal storage?
body: <p>I need to store some data as a text file on the internal storage.
  for example below, I have a button, I'd like to save some data in a text file each time the button is clicked. I am testing an example in:</p>
  
  <p><a href="http://developer.android.com/training/basics/data-storage/files.html" rel="noreferrer">http://developer.android.com/training/basics/data-storage/files.html</a></p>
  
  <pre><code>import java.io.FileOutputStream;
  import android.os.Bundle;
  import android.app.Activity;
  import android.content.Context;
  import android.view.Menu;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  
  public class MainActivity extends Activity implements OnClickListener {
      Button b;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          b = (Button) findViewById(R.id.button1);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      @Override
      public void onClick(View v) {
          String filename = "myfile";
          String string = "Hello world!";
          FileOutputStream outputStream;
  
          try {
            outputStream = openFileOutput(filename, Context.MODE_APPEND);
            outputStream.write(string.getBytes());
            outputStream.close();
          } catch (Exception e) {
            e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>I only changed the "mode_private" to "mode_append", so I can see the saved file, but I cannot find the saved file, I even cannot find the directory in which the file is supposed to be saved.</p>
  
  <p>Also, more specifically, I need to store an array of numbers in the text file (say i={1,2,3} to output.txt).
  I would be grateful if you can help me out.</p>