title: Calling fragment method from activity
body: <p>I have one in my project ViewPage with two fragments (FragmentView1 and FragmentView2).</p>
  
  <p>This is my ViewPage MainActivity, which has a ActionBar with a menu.</p>
  
  <p>In this menu, each option should call a method that is in FragmentView1 to update it.</p>
  
  <p>But I really do not know how to do this!</p>
  
  <p>This is the method in my FragmentView1:</p>
  
  <pre><code>public void loadPoema(){
      // my code here
  }
  </code></pre>
  
  <p>And here is where I call it from my Activity:</p>
  
  <pre><code>@Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle presses on the action bar items
          switch (item.getItemId()) {
              case R.id.actBack:
                  postAtual--;   
                          // Here I call the method in FragmentView1          
                  return true;
              default:
                  return super.onOptionsItemSelected(item);
          }
      }
  </code></pre>
  
  <p>To learn the method in question in FragmentView1 serves to update it (the very Fragment) loading new data.</p>
  
  <p>once again apologize here for my level, I'm using Google Translator</p>
  
  <p>EDIT</p>
  
  <p>MainActivity XML:</p>
  
  <pre><code>&lt;LinearLayout 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"
      android:orientation="vertical"
      tools:context=".MainActivity" &gt;
  
      &lt;android.support.v4.view.ViewPager
         android:id="@+id/viewpager"
         android:layout_width="fill_parent"
         android:layout_height="0dp"
         android:layout_weight="1"&gt;
  
              &lt;android.support.v4.view.PagerTabStrip
                  android:id="@+id/pagerTabStrip"
                  android:layout_gravity="bottom"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"
                  android:background="#cccccc"/&gt;
  
      &lt;/android.support.v4.view.ViewPager&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Fragment XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:padding="@dimen/activity_horizontal_margin"
      android:id="@+id/fragPoema"
      android:orientation="vertical" &gt;
  
      &lt;TextView
          android:id="@+id/txtTitulo"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:gravity="center"
          android:textStyle="bold"
          android:textSize="18sp"
          android:textColor="#0099FF"
          android:typeface="serif" /&gt;
  
      &lt;TextView
          android:id="@+id/txtPoema"
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:layout_marginTop="10dp"
          android:textColor="#333333"
          android:layout_gravity="center"
          android:scrollbars="vertical"
          android:typeface="serif" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And MainActivity code:</p>
  
  <pre><code>private void loadViews(){
          mViewPager = (ViewPager) findViewById(R.id.viewpager);
  
          TitleAdapter titleAdapter = new TitleAdapter(getSupportFragmentManager());
          mViewPager.setAdapter(titleAdapter);
          mViewPager.setCurrentItem(0);
      }
  </code></pre>