title: Fragment / ViewPager in FragmentPagerAdapter not updating its View
body: <p>I have a FragmentPagerAdapter which holds several Fragments. The content of these Fragments change, but I did not get the Fragment to update in my update function.
  I already tried these suggestions without luck:</p>
  
  <p><a href="https://stackoverflow.com/questions/7263291/viewpager-pageradapter-not-updating-the-view">ViewPager PagerAdapter not updating the View</a></p>
  
  <p><a href="https://stackoverflow.com/questions/7796952/android-force-fragment-to-rebuild-view">Android force Fragment to rebuild View</a></p>
  
  <p>Here is a sniped of my code:</p>
  
  <pre><code>private void updateNavigation() {
  //update code to redraw the fragment
  //not workind
  //mNavigationViewPager.getAdapter().notifyDataSetChanged();
          FragmentManager fragmentManager = getFragmentManager();
          FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
          Bundle args = new Bundle();
          AFragment newFragment = new AFragment();
          args.putString("test");
          newFragment.setArguments(args);
  
          FragmentTransaction transaction = getFragmentManager().beginTransaction();
          transaction.replace(R.id.navigation_pager, newFragment);
          transaction.addToBackStack(null);
          transaction.commit();
  </code></pre>
  
  <p>and this is the fragment:</p>
  
  <pre><code>public static class AFragment extends Fragment {
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                  Bundle savedInstanceState) {
              // Inflate the layout for this fragment, draw layout dynamically
              MyLinearLayout fl = new MyLinearLayout(getActivity());
                      Button btn = new Button(getActivity());
                      btn.setText(String.valueOf(cnt++));   
                      btn.setGravity(Gravity.LEFT);
                      btn.setPadding(28, 7, 0, 0);
                      fl.addView(btn, new MyLinearLayout.LayoutParams(7, 5, 70, 50));
                      fl.setPadding(5, 5, 5, 5);
              }
              return fl;
          }
      }
  </code></pre>
  
  <p>activity on create:
  (..)</p>
  
  <pre><code> mNavigationViewPager = new ViewPager(this);
              mNavigationViewPager.setId(R.id.navigation_pager);
              mTabsAdapter = new TabsAdapter(this, mNavigationViewPager);
      mTabsAdapter.addTab(actionBar.newTab().setText("text1"),
                      fragmentNr1, null);
   actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  </code></pre>
  
  <p>When I call</p>
  
  <pre><code>actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
  </code></pre>
  
  <p>an an options menu interaction and afterwards do</p>
  
  <pre><code>actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  </code></pre>
  
  <p>in another options menu, the fragments gets updated correct. </p>