Pregunta

I have FragmentTabHost with children tabs (Fragment)

public void onCreate(Bundle savedInstanceState) {
    ...
    mTabHost.addTab(newTabSpec, MainTab.class, new Bundle())
    ... 
}

How i can call public method from my MainTab (or other tab)?

public class MainTab extends Fragment {
    public void showNews() {
        ...
    }
}

and vice versa

how i can call any method from FragmentTabHost inside it children tab (Fragment).

Another words, i need know how get link to any children Fragment than is tab in FragmentTabController. How i can get object "MainTab" inside TabHos?

For example in iOS i cat get first viewcontroller from children tab like this:

UINavigationController *navController = [appDelegate.tabController.viewControllers objectAtIndex: 1]

Is there a similar method in android?

¿Fue útil?

Solución

O'k. I was wrong in concept when try get reference to any fragment or view from another. In android i should use events instead.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top