title: Android Calling objects from fragments
body: <p>I'm not sure the best way to go about what I intend to do.  I have an app that involves three fragments, each navigated to by a single activity that has a navigation drawer.  </p>
  
  <p>I have a text to speech class that initialises the text to speech engine.  The problem is, is that it needs to be used by multiple different fragments.  My idea was to create an object of the TTS class in the main Activity and extend functions so that they can be called by the fragments, like so:</p>
  
  <pre><code>@Override
      public void onActivityCreated(@Nullable Bundle savedInstanceState) {
          super.onActivityCreated(savedInstanceState);
          mTextToSpeechService = ((NavigationActivity)this.getActivity()).GetTextToSpeechService();
      }
  </code></pre>
  
  <p>The problem I see here is, what if I need to do something such as change the language within one fragment.  That would mean I'd have to expose another function to set the TTS class within the activity, which doesn't seem right.</p>
  
  <p>What is the best way to go about this?</p>