title: Android Fragments and findFragmentByTag()
body: <p>I have a parent FragmentActivity with three child Tab Fragments. When a "Submit" button is pressed on the FragmentActivity, I want to sum the values of all the EditText fields in the different Tab Fragments. I think I have the right idea, using getSupportFragmentManager().findFragmentByTag(), however I'm finding that it is only returning values for the current active Fragment. I was under the assumption that I could access the inactive (or not visible) Tab Fragment's as well:</p>
  
  <pre><code>int sum1 = getSupplyQuantities(Constants.TAB_TAG1);
  int sum2 = getSupplyQuantities(Constants.TAB_TAG2);
  int sum3 = getSupplyQuantities(Constants.TAB_TAG3);
  int sum4 = getSupplyQuantities(Constants.TAB_TAG4);
  
  private int getSupplyQuantities(String string) {
      Activity tab = getSupportFragmentManager().findFragmentByTag(string)
              .getActivity();
  
      LinearLayout linearLayout = (LinearLayout) tab
              .findViewById(R.id.get_supplies_layout);
  
              int sum = 0;
  
      for (int i = 0; i &lt; linearLayout.getChildCount(); i++) {
          View view = linearLayout.getChildAt(i);
  
          QuantityTextView quantity = (QuantityTextView) view
                  .findViewById(R.id.get_supplies_list_quantity);
  
          sum += Integer.parseInt(quantity.getText().toString());
  
      }
  
      return sum;
  
  }
  </code></pre>
  
  <p>In the above scenario, sum1, sum2, sum3, and sum4 will all be the same. They will be the sum for the active Tab Fragment.</p>
  
  <p>Does anyone have any ideas?</p>
  
  <p>Thanks!</p>