new Thread() {@Overridepublic void run() {// 看门狗, 不停的查看当前activity任务栈的栈顶while (true) {// 首先获取到最上面的任务栈, get(0) 获取到任务栈栈顶的activityString packname = activityManager.getRunningTasks(1).get(0).topActivity.getPackageName();for (LockAppInfo apppackinfo : blockappinfos) {if (packname.equals(apppackinfo.getPackname())) {if (!apppackinfo.isFlagcanstart()) {// 弹出对话框,弹出新的activity 覆盖当前要启动的activityintent.putExtra("packagename", packname);startActivity(intent);}}}try {Thread.sleep(200);} catch (InterruptedException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}}.start();