title: How to get top Running Application in 5.1?
body: <p>I am creating an application which will give me currently running task , it is working perfectly bellow 5.1 Lollipop  </p>
  
  <p>this is my code for bellow 5.1</p>
  
  <pre><code>mPackageName = ActivityManager.getRunningTasks(1).get(0).topActivity.getPackageName();
  </code></pre>
  
  <p><strong>(I want only single application which is currently running)</strong></p>
  
  <p>but in 5.1 it is not giving me the right package</p>
  
  <p>this code is running every 1 second. Please give me some suggestions</p>
  
  <p>Thanks
  Amit</p>