I have an android app that has several tabs. To create the tabs I used the following tutorial:
http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/
So the tabs are implemented using Fragments that are handled by TabsPagerAdapter
which extends FragmentPagerAdapter
.
However I have having trouble calling a method in one of the fragments from my main activity.
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.
I was hoping that somebody would be able to help me find the best way to do this.