title: Writing to a file with context - Android
body: <p>I created a button which should write the selected item from two dropdown-spinners into a txt-file. </p>
  
  <p>To do this I am using this method:</p>
  
  <pre><code>    public static void save(Context ctx) {
      FileOutputStream fos;
      try {
  
          fos = ctx.openFileOutput("config.txt", Context.MODE_PRIVATE);
  
  
          ObjectOutputStream oos = new ObjectOutputStream(fos);
          oos.writeObject(MyActivity.klasse);
          oos.close();
      } catch (FileNotFoundException e) {
          e.printStackTrace();
      }catch(IOException e){
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>This is my onClickListener:</p>
  
  <pre><code>btnSave.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
  
                  String text = sp_jahrgang.getSelectedItem().toString() + sp_klasse.getSelectedItem().toString();
                  System.out.println("JAHRGANG:"+text);
  
                  MyActivity.klasse = text;
                  System.out.println("TEST:"+MyActivity.klasse);
                  save();
          }
      });
  </code></pre>
  
  <p>The problem is that I do not really understand the concept of "context". I do not know what kind of context I have to use. What do I have to put into the brackets for the method save?</p>
  
  <p>Any help is appreciated </p>