So I got three ViewPagers.
MainPager
this one contains all views and bothScoreboardPager
andStopwatchPager
ScoreboardPager
this contains a fewTextViews
which act like timersStopwatchPager
this contains a fewTextViews
which keep track of score
The issue with this is that I'm unable to get any of the TextViews
from either 2 or 3.
I call findViewFromId
inside StopwatchFragment
and ScoreboardFragment
, like this:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main_stopwatch, container, false);
MainFragment.StopwatchTimeBlue = (TextView) rootView.findViewById(R.id.stopwatchTimeBlue);
MainFragment.StopwatchTimeOrange = (TextView) rootView.findViewById(R.id.stopwatchTimeOrange);
return rootView;
}
When I try and assign a value to it, it won't get updated. I assign it like this, inside MainFragment
.
if (blueScore > 0) {
if (StopwatchTimeBlue != null) {
Log.i("Timer", String.format("Found stopwatchTimeBlue, value is ", StopwatchTimeBlue.getText().toString()));
StopwatchTimeBlue.setText(timeInText);
}
}
Any help is welcome