title: Error with openFileOutput in Fragments
body: <p>I'm reading the <a href="http://developer.android.com/guide/topics/data/data-storage.html" rel="nofollow">API Guides - Data Storage</a> and I'm going crazy with an error. I'm trying to implement <code>openFileOutput</code> in a fragment but I can't do it.</p>
  
  <p>Android Studio gives me the following error in <code>FileOutputStream fos = fileContext.openFileOutput(FILENAME, fileContext.MODE_PRIVATE);</code> line.</p>
  
  <blockquote>
    <p>Unhandled exception: java.io.FileNotFoundException</p>
  </blockquote>
  
  <p>Here is the full code:</p>
  
  <pre><code>public class SavingDataFragment extends Fragment {
  
  EditText entryData;
  
  @Override
  public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
  
      return inflater.inflate(R.layout.fragent_saving_data, container, false);
  }
  
  public void saveInInternalStorage (View view, Context fileContext){
  
      entryData = (EditText) view.findViewById(R.id.edtText_entry_SavingData);
      String dataToSave = entryData.getText().toString();
  
      String FILENAME = "myFile";
  
      FileOutputStream fos = fileContext.openFileOutput(FILENAME, fileContext.MODE_PRIVATE);
  }
  </code></pre>
  
  <p>A lot of thanks for your help.</p>