title: How to get running application activity Name in android 5.0(L)?
body: <p>I am using the following code to get the current running activity name in android.</p>
  
  <pre><code>ActivityManager am = (ActivityManager) aContext
                  .getSystemService(Context.ACTIVITY_SERVICE);            
  List&lt;ActivityManager.RunningTaskInfo&gt; alltasks = am
                  .getRunningTasks(1);
  
  ComponentName componentInfo = alltasks.get(0).topActivity;
  componentInfo.getClassName();
  
  System.out.println("Current:"+componentInfo.getClassName());
  </code></pre>
  
  <p>This is working fine in all the versions below android <code>5.0</code>. But in Android 5.0 it <strong>always returning the launcher activity</strong>.</p>
  
  <p>Please any one help in this because I want to make run the application in all android versions.</p>