Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7189635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:20:39+00:00 2026-05-28T19:20:39+00:00

I want to develop a task manager like application where I want to display

  • 0

I want to develop a task manager like application where I want to display the list of runnung services and the memory used by each service in a list view.

I figured that running services can be obtained using

ActivityManager am = (ActivityManager)this.getSystemService(Context.ACTIVITY_SERVICE);
List<RunningServiceInfo> procInfos = am.getRunningServices(maxNum);

But how to dislay them in a ListView and also how to obtain the memory used by each one of them?
I am an android beginner and I wish anyone could explain me in a detailed manner…

I tried the following. I could see the service name etc in logcat but the apllication is force closing.

 package com.example.ServiceList;

 import java.util.List;

 import android.app.Activity;
 import android.app.ActivityManager;
 import android.app.ActivityManager.MemoryInfo;
 import android.app.ActivityManager.RunningAppProcessInfo;
 import android.app.ActivityManager.RunningServiceInfo;
 import android.content.Context;
 import android.os.Bundle;
 import android.util.Log;
 import android.widget.TextView;

 public class ServiceListActivity extends Activity {
 /** Called when the activity is first created. */
   int maxNum = 5;

   @Override
   public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      TextView tv = new TextView(this); 
      this.setContentView(tv);  

      android.os.Debug.MemoryInfo[] mInfo;
      int[] processid = null;

      ActivityManager am = (ActivityManager)this.getSystemService       (Context.ACTIVITY_SERVICE); 

    List<RunningServiceInfo> procInfos = am.getRunningServices(maxNum); 

     for(int i = 0; i < procInfos.size(); i++){

          tv.setText(tv.getText().toString()+ " " + "\n");
       Log.v("TaskMgr Stringe", procInfos.get(i).service.toString());
       Log.v("TaskMgr class name", procInfos.get(i).service.getClassName());
       processid[i]=procInfos.get(i).pid;
       String s = " "+processid[i];
       Log.v("TaskMgr process id",s );


       Log.v("TaskMgr process memory", am.getProcessMemoryInfo(processid[0]);
    }

       mInfo = am.getProcessMemoryInfo(processid);

       int dp= mInfo[0].dalvikPss;
       String s1= " " + dp;
       tv.setText(tv.getText().toString()+ " " + s1 );      
   }
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:20:39+00:00Added an answer on May 28, 2026 at 7:20 pm

    You should begin by looking at what a RunningServiceInfo has that is available… that you can use for your ListView’s data.

    If this does not have what you need then you may need to look at the source of how the original battery application that is packaged in the source of android does it. A good branch to look at would be version 2.3.3.

    Always having the android source to reference will save you a lot a headache.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to develop a web application, like an online scheduler. (Yes I know
I am assigned a task to develop a large scale social web application like
I want to develop an application where i want to free memory from other
I would like to develop an application which runs as a background service .
I want to develop a windows application. If I use native C++ and MFC
I want to develop a mobile web application using asp.net 3.5 that can be
I want to develop an iPhone application using the utility template, where the flip
I want to develop an application that disables the Background Data (new feature in
I want to develop a photo browser application in Windows platfrom, the UI should
I want to develop an application in which i doesn't any idea about how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.