title: How to change the text inside a fragment from an activity?
body: <p>In my adnroid app when the user goes to their own profile, there is a fragment there with two buttons - X points and settings.
  For the button X points I want to change the text to whatever the amount of points they have, for example 12 points.</p>
  
  <p>I've tried numerous things but nothing seems to work:</p>
  
  <p>Attempt 1:</p>
  
  <pre><code>        myProfileActionButtonsHolder = (TableRow) findViewById(R.id.myProfileActionButtonsHolder);
          getSupportFragmentManager().beginTransaction().replace(R.id.myProfileActionButtonsHolder, new MyProfileActionButtonsFragment()).commit();
  
          MyProfileActionButtonsFragment.bMyProfilePoints = (Button) findViewById(R.id.bMyProfilePoints);
          MyProfileActionButtonsFragment.bMyProfilePoints.setText("asd");
  </code></pre>
  
  <p>Attempt 2:</p>
  
  <pre><code>    MyProfileActionButtonsFragment myProfileActionButtonsFragment = (MyProfileActionButtonsFragment) getSupportFragmentManager().findFragmentById(R.id.myProfileActionButtonsHolder);
      ((Button)myProfileActionButtonsFragment.getView().findViewById(R.id.bMyProfileSettings)).setText("asd");
  </code></pre>
  
  <p>Attempt 3</p>
  
  <pre><code>myProfileActionButtonsFragment.setBMyProfileSettingsText("asd"); //setBMyProfileSettingsText is a custom method defined inside the fragment
  </code></pre>
  
  <p>Here is how my fragment looks:</p>
  
  <pre><code>public class MyProfileActionButtonsFragment extends SherlockFragment {
      public static Button bMyProfilePoints;
      public Button bMyProfileSettings;
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
  
          View view= inflater.inflate(R.layout.my_profile_action_buttons_fragment, container, false);
          bMyProfilePoints = (Button) view.findViewById(R.id.bMyProfilePoints);
          bMyProfileSettings = (Button) view.findViewById(R.id.bMyProfileSettings);
  
           return view;
      }
  
      public void setBMyProfileSettingsText(String text) {
          bMyProfilePoints.setText(text);
      }
  }
  </code></pre>
  
  <p>Im ALWAYS getting a NullPointerException on the line where I try to set the text to the button.</p>