I have list of running task by the following code .
final List<RunningTaskInfo> recentTasks = activityManager.getRunningTasks(Integer.MAX_VALUE);
Now I want to get app name, package name and app icon of these running tasks. How can I do that?
I have list of running task by the following code .
final List<RunningTaskInfo> recentTasks = activityManager.getRunningTasks(Integer.MAX_VALUE);
Now I want to get app name, package name and app icon of these running tasks. How can I do that?
try this:
public void trythis(Context m_context )
List<RunningAppProcessInfo> m_runningProcesses = getRunningProcess(m_context);
PackageManager pm = m_context.getPackageManager();
if (m_runningProcesses.size() > 0)
{
Iterator<RunningAppProcessInfo> it = m_runningProcesses.iterator();
while (it.hasNext())
{
boolean isInternetPermission = false;
RunningAppProcessInfo rapInfo = (RunningAppProcessInfo) it
.next();
PackageInfo pkgInfo = pm.getPackageInfo(rapInfo.pkgList[0],
PackageManager.GET_META_DATA);
ApplicationInfo appInfo = pm.getApplicationInfo(
pkgInfo.applicationInfo.packageName, 0);
//For icon
Drawable iconp;
iconp = appInfo.loadIcon(getPackageManager());
//Application name:
String Appname = appInfo.loadLabel(getPackageManager())
.toString();
}
}