title: Show toast at current Activity from service
body: <p>I need to show Toast at the current Activity if it come some updatings to the Service. So Service call server and if it is some updatings, I need to notificate user nevermind at which Activity he is. I try to implement it like this:</p>
  
  <pre><code> Toast.makeText(ApplicationMemory.getInstance(), "Your order "+progress+"was updated", 
                       Toast.LENGTH_LONG).show();
  </code></pre>
  
  <p>where </p>
  
  <pre><code>public class ApplicationMemory extends Application{
  static ApplicationMemory instance;
  
     public static ApplicationMemory getInstance(){
          return instance;
      }
  }
  </code></pre>
  
  <p>and it doesn't works. I also tried to get current Activity name with </p>
  
  <pre><code>ActivityManager am = (ActivityManager) ServiceMessages.this.getSystemService(ACTIVITY_SERVICE);
  List&lt; ActivityManager.RunningTaskInfo &gt; taskInfo = am.getRunningTasks(1);
  ComponentName  componentInfo = taskInfo.get(0).topActivity;
  componentInfo.getPackageName();
  Log.d("topActivity", "CURRENT Activity ::"  + componentInfo.getClassName());
  </code></pre>
  
  <p>But don't know how to get context object from the ComponentName. </p>