title: Calling a fragment method from an activity android tabs
body: <p>I have an android app that has several tabs. To create the tabs I used the following tutorial:</p>
  
  <p><a href="http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/" rel="nofollow noreferrer">http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/</a></p>
  
  <p>So the tabs are implemented using Fragments that are handled by <code>TabsPagerAdapter</code> which extends <code>FragmentPagerAdapter</code>.</p>
  
  <p>However I have having trouble calling a method in one of the fragments from my main activity.</p>
  
  <p>I want to call this method when my main activity receives a message. More specifically I need to update the UI of the fragment when this message is received. But I am not sure how to properly identify the fragment as it was not declared in an xml and therefore does not have a tag/id.</p>
  
  <p>I was hoping that somebody would be able to help me find the best way to do this.</p>