title: How to retrieve a context from a non-activity class?
body: <p>I have found <a href="https://stackoverflow.com/questions/4177731/android-how-to-call-method-from-another-class-without-passing-context">one answer</a> that appears to say I should create a separate class and make a static MyApplication object and make a get method. Then any class can call MyApplication.get() to retrieve the context. </p>
  
  <p>Is there any other cleaner way? This is my situation:</p>
  
  <p>I have a class A and a class B. Class A contains an object from class B (let's call the object b). In class A I call, "b.play()". However, I get a null pointer exception because class B needs to pass a context to the MediaPlayer.create() method. </p>
  
  <p>Until now I threw together a hack and from class A I called.... "b.play(this)" and simply passed the context to B. However that is pretty ugly and looks like a bad use of OOP. </p>
  
  <p>Any thoughts? </p>