title: NotifyDataSetChanged from fragment container
body: <p>I have an app with an <code>Activity</code> that hosts a <code>ListFragment</code>, an <code>EditText</code>, and a <code>Button</code>. When the user presses the <code>Button</code>, I want to add the text in the <code>EditText</code> to the <code>ListFragment</code>. I know to do this, I would have to call the <code>Fragment</code>'s adapter's <code>notifyDataSetChanged()</code> method, but I don't now how I would go about doing that. I also don't know how I would call the adapter's add method, but I get the feeling that if I figured out how to do one, I'll be able to figure out how to do the other.</p>
  
  <p>Any help would be awesome.</p>
  
  <p>Edit: Further clarification:</p>
  
  <p>So the hosting <code>Activity</code> (ThreadContainer.java) inflates its layout, which contains the <code>ListFragment</code>, like so:</p>
  
  <pre><code>    protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_thread_container);
          ...
  </code></pre>
  
  <p>Here's activity_thread_container.xml:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              tools:context="com.claymon.android.cryptosms.ThreadContainer"&gt;
  
  &lt;fragment
      android:id="@+id/thread_container"
      android:name="com.claymon.android.cryptosms.MessageFragment"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentTop="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_above="@+id/newMessageText"/&gt;
  
  &lt;EditText
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/newMessageText"
      android:layout_alignParentBottom="true"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:inputType="text|textMultiLine"
      android:focusable="true"
      android:maxLines="4"
      android:maxLength="2000"
      android:scrollHorizontally="false"
      android:stackFromBottom="true"
      android:transcriptMode="alwaysScroll"
      android:layout_toLeftOf="@+id/sendButton"
      android:layout_toStartOf="@+id/sendButton"/&gt;
  
  &lt;Button
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="@string/send"
      android:id="@+id/sendButton"
      android:layout_alignParentBottom="true"
      android:layout_alignParentRight="true"
      android:layout_alignParentEnd="true"/&gt;
  </code></pre>
  
  <p></p>
  
  <p>Then, <code>MessageFragment</code>, which extends <code>ListFragment</code>, just displays some predetermined data using a fairly simple custom <code>ArrayAdapter</code>. The code here is more or less irrelevant. What I want to do is call my custom <code>ArrayAdapter</code>'s methods from within ThreadContainer.java. Basically, I need to figure out how to access the fragment that I created when I inflated my layout.</p>
  
  <p>Sorry for the poor initial question.</p>