title: How can I save information from a Edittext to the original file in android
body: <p>I'm struggling with how to save changes to my file.txt using edittext. So far my code will allow me to open up the text file, but when closing it, it will not save the changes that have been made. The text file is being opened into another activity and will save the changes when orientation changes and if it is minimized. I have tried loads of different solutions but i cannot get my head around how to store the changes that have been made. </p>
  
  <pre><code>public class Editor extends Activity {
  private String Text;
  private String Folder;
  private String toast;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_editor);
      Bundle extras = getIntent().getExtras(); 
      this.Text = extras.getString ("txt");
      this.Folder = extras.getString("s");
      this.toast = (Folder + "/" + Text);
      Toast.makeText(this, toast, Toast.LENGTH_SHORT).show();
      File sdcard = Environment.getExternalStorageDirectory();
      File file = new File(sdcard + "/NoteTaker/" + Folder + "/" + Text);
      StringBuilder text = new StringBuilder();
      try {
      BufferedReader br = new BufferedReader(new FileReader(file));
      String line;
      while ((line = br.readLine()) != null) {
      text.append(line);
      text.append('\n');
      }
      }
      catch (IOException e) {
      }
      TextView tv = (TextView)findViewById(R.id.editText1);
      tv.setText(text);
      getActionBar().setDisplayHomeAsUpEnabled(true);
  
  }   
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.activity_editor, menu);
      return true;
  }
  </code></pre>