user2741397
user2741397

Reputation: 15

Passing data between tabbed fragment lists

I have implemented:

public class CategoryListFragment extends ListFragment 
(Categories) Tab1

public class CrimeListFragment extends ListFragment
(List of crimes) Tab2 

-- If you click on the tab it returns ALL crimes.

public class CrimeFragment extends Fragment
(Individual Crime) Tab 3

-- If you click on the tab it returns first crime.

And the activity that hosts all of the tabs:

public class TabsFragmentActivity extends FragmentActivity implements TabHost.OnTabChangeListener

What I want to implement is an onListItemClick on (Tab 1) "Categories" that passes the ID or string to Tab 2 so that only the crimes of that category are displayed.

Upvotes: 0

Views: 1158

Answers (1)

flx
flx

Reputation: 14226

This is already described in the official android documentation. please follow the link and read about it there: https://developer.android.com/training/basics/fragments/communicating.html

Upvotes: 1

Related Questions