title: How to create editText in fragment
body: <p>I'd like to create editable textfield in fragment, which after close or stop of app would be saved. But there's something wrong in line with <code>return notatki;</code> I already have this:</p>
  <pre><code>public class DetailFragment2 extends Fragment {
  
      private EditText notatki;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          Log.e(&quot;Test&quot;, &quot;hello&quot;);
  
  
      }     
      @SuppressLint(&quot;SimpleDateFormat&quot;)
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup parent,
              Bundle savedInstanceState) {
  
          View view = inflater.inflate(R.layout.details2, parent, false);
          notatki = (EditText) view.findViewById(R.id.editText1);
          SharedPreferences settings = this.getActivity().getSharedPreferences(&quot;PREFS&quot;, 0);
          notatki.setText(settings.getString(&quot;value&quot;, &quot;&quot;));
          return view;
      }  
      @Override
      public void onStop( ){
          super.onStop();
          if(notatki.getText() != null) {
              SharedPreferences settings = this.getActivity().getSharedPreferences(&quot;PREFS&quot;, 0);
              SharedPreferences.Editor editor = settings.edit();
              editor.putString(&quot;value&quot;, notatki.getText().toString());
              editor.commit();
          }
      }
  }
  </code></pre>
  <p>When I change <code>return notatki;</code> to <code>return view;</code> it works until the stop of app, when I wanted to save content of editText but it isn't saving anything.</p>