Monday, 12 August 2013

How to access a UI element in a fragment?

How to access a UI element in a fragment?

I have a fragment with a control (a TextView) with id
R.id.currentCycleIndicator and want to programmatically set its value from
within the fragment.
Both
getActivity().findViewById(R.id.currentCycleIndicator) and
getView().findViewById(R.id.currentCycleIndicator)
return null.
How can I get reference to that TextView inside the fragment code?

No comments:

Post a Comment