title: How to Save A POJO Object In Internal Storage
body: <p>as the title suggests I am having trouble saving a pojo onto my phones internal storage through SharedPreferences. Here is my code to create the pojo:</p>
  
  <pre><code>class dataPOJO{
  String fileName;
  String cName;
  String[] cN;
  
  
  public String getName() {
      return cName;
  }
  
  public void setName(String cName) {
      this.cName = cName;
  }
  
  public String getFileName() {
      return fileName;
  }
  
  public void setFileName(String fileName) {
      this.fileName = fileName;
  }
  
  public String[] getText() {
      return cN;
  }
  
  public void setExtras(String[] cN) {
      this.cN = cN;
  }
  
  public String toString() {
      String savePackage = "File Name: " + getFileName() + "\n";
      savePackage += "CName: " + getName() + "\n";
      savePackage += getText() + "\n";
      return savePackage;
  }
  }
  </code></pre>
  
  <p>And my attempt to save the pojo:</p>
  
  <pre><code>fileName.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              //doc identifier stuff
              SharedPreferences sharedPrefs = getSharedPreferences("DOC_INT",Context.MODE_PRIVATE);
              SharedPreferences.Editor editor = sharedPrefs.edit();
              doc_id++;
              editor.putInt("doc_id",doc_id);
              editor.commit();
              //dataPojo stuff
              SharedPreferences sharedSavePrefs = getSharedPreferences("DATA"+doc_id,Context.MODE_PRIVATE);
              SharedPreferences.Editor save_editor = sharedSavePrefs.edit();
  
  
              dataPojo.setNotes(save_text_notes);
              dataPojo.setName(save_text_class_name);
              dataPojo.setFileName(file_name);
  
  
  
  
  
  
  
  
  
  
  
          }
      });
  </code></pre>
  
  <p>The reason why I have a doc identifier int is because I plan on having the user save multiple dataPojos, and I figured this would be the best way to identify/retrieve them later in another activity.The current problem I am facing is SharedPreferences will not allow me to store an object. How can I save each pojo the user creates internally with a specific identifier?  Thanks!</p>