Given:
- From a fragment, you can always call
getActivity()
to get a reference to the activity in context.- And of course, you can you can cast this instance to a strong type (like
MainActivity
) to get references to public properties and public methods on the activity.
- And of course, you can you can cast this instance to a strong type (like
My Question:
- Is this bad form? Should it be avoided?
- Specifically, should references to properties and methods on an activity be acquired via interfaces?
- Or is it standard practice to expose public properties and methods to fragments from an activity?