Back to project page permission-explorer.
The source code is released under:
Copyright (C) 2012 Rui Gon?alves and Daniel Cibr?o Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),...
If you think the Android project permission-explorer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package pt.up.fe.ssin.pexplorer.actions; /*from w w w. ja v a2 s .c o m*/ import java.util.Iterator; import java.util.List; import pt.up.fe.ssin.pexplorer.R; import pt.up.fe.ssin.pexplorer.app.PermissionAction; import android.app.ActivityManager; import android.app.ActivityManager.RunningTaskInfo; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; public class RetrieveRunningTasksAction extends PermissionAction { public RetrieveRunningTasksAction() { super(R.string.retrive_running_tasks_label, R.string.retrive_running_tasks_label, PermissionAction.DO_NOTHING); } @Override protected void doAction(final Context context) { ActivityManager mgr = (ActivityManager) context .getSystemService(Context.ACTIVITY_SERVICE); List<RunningTaskInfo> tasks = mgr.getRunningTasks(100); String text = context.getString(R.string.retrieve_running_tasks_intro); for (Iterator<RunningTaskInfo> i = tasks.iterator(); i.hasNext();) { RunningTaskInfo p = (RunningTaskInfo) i.next(); text += p.baseActivity.flattenToShortString() + "\n"; } new AlertDialog.Builder(context) .setTitle(R.string.retrive_running_tasks_label) .setMessage(text) .setCancelable(true) .setPositiveButton(R.string.continue_, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }).show(); } }