/** * @return 手机当前的activity */ String getRunningActivityName(){ ActivityManager activityManager=(ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); String runningActivity=activityManager.getRunningTasks(1).get(0).topActivity.getClassName(); return runningActivity; }