-1

I want to view the contents of activity in a fragment, I have a table in activity that contains statistics and I want to compare it with other table in a fragment How can I do This?

M--
  • 25,431
  • 8
  • 61
  • 93
Hamza Ay
  • 9
  • 3

2 Answers2

0

When you starting fragment put extra bundle into it:

https://stackoverflow.com/a/12739968/5577679

Or (wrong way) set that table to be static and just use it as it is part of the fragment:

String row1 = getActivity.yourTable[0];
Community
  • 1
  • 1
tompadre
  • 797
  • 7
  • 22
0

In your activity create a function

public Table getYourTableStatistics(){
   return yourTable;
}

in your fragment use it like

((YourActivity)getActivity()).getYourTableStatistics();
mudit_sen
  • 1,470
  • 15
  • 24