title: Retrieve calling Activity from Intent in Android
body: <p>I am trying to pass along my activity pointer in my intent but I don't know how to retrieve it.</p>
  
  <p>I have a calling activity (MyActivity) with the following snippet of code:</p>
  
  <pre><code>Intent myServiceIntent = new Intent(this, myService.class);
  startService(myServiceIntent);
  </code></pre>
  
  <p>In my service class I want to retrieve the calling activity. 
  Something like this:</p>
  
  <pre><code>private Activity CurrentActivity = null;    
  public int onStartCommand(Intent intent, int flags, int startId) 
      {
          CurrentActivity = (CurrentActivity) intent.getClass();
          return super.onStartCommand(intent, flags, startId);
      }
  </code></pre>
  
  <p>This doesn't work but I also don't know what does. 
  I also couldn't find a putExtra that takes an activity as parameter.
  So how can I do this?</p>