Android Studio 检查Top Activity

  public void CheckTop(String packagename,int casenum)
{
Context context = getBaseContext();
ActivityManager am = (ActivityManager) context.
getSystemService(Activity.ACTIVITY_SERVICE); String className = am.getRunningTasks(1).get(0).topActivity.getClassName();
if(!className.contains(packagename) )
{
lo
Log.d("TAG", " Test fail...");
}
else
{
Log.d("TAG", " Test pass...");
}
}

  

上一篇:关东升的《从零開始学Swift》即将出版


下一篇:Docker Note1——架构和三要素