title: Fragment savedInstanceState not working
body: <p>I have several fragments here and there's this one fragment where I want to save its state when I get back to it. I tried doing it in a testfragment where, when I click the button, the textview text will change to "test1"(The default text of the textview is "New Text"). So the textview changes the text, but when I move into another fragment and get back to it (<code>HomeFragment</code>), the textview is going to its default state text ("New Text"). So I think the <code>savedInstanceState</code> is not working because if it does, it should have "test1" when I get back to the fragment. Here's my code: </p>
  
  <pre><code>public class HomeFragment extends Fragment {
      public Button button;
      public TextView txt_test;
      public String data_test;
      public HomeFragment() {
          // Required empty public constructor
      }
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
          View view = inflater.inflate(R.layout.fragment_home, container, false);
  
          return view;
      }
  
      public void onActivityCreated(Bundle savedInstanceState){
          super.onActivityCreated(savedInstanceState);
          if(savedInstanceState == null){
  
          }
          else{
              data_test = savedInstanceState.getString("txt_test");
              txt_test = (TextView) getActivity().findViewById(R.id.textView2);
              txt_test.setText(data_test);
          }
          button = (Button) getActivity().findViewById(R.id.button3);
          txt_test = (TextView) getActivity().findViewById(R.id.textView2);
          button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  txt_test.setText("test1");
  
              }
          });
      }
  
      public void onSaveInstanceState(Bundle savedInstanceState){
          super.onSaveInstanceState(savedInstanceState);
          savedInstanceState.putString("txt_test",data_test);
      }
  
  }
  </code></pre>