原文地址:http://blog.csdn.net/wcs542882916
ActivityManager am=(ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningTaskInfo> runningTasks= am.getRunningTasks(1);
if(runningTasks!= null && runningTasks.size() <= 0){ return false; }
ComponentName comName = runningTasks.get(0).topActivity;
Log.d(TAG, "--->comName:"+comName.getClassName());