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 4096078
In Process

The Archive Base Latest Questions

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

I am trying to display all running tasks as a check box list so

  • 0

I am trying to display all running tasks as a check box list so i can select any of these tasks but every time i try to run it on emulator, its giving me forceclose error.

here is my code:-

public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    am = (ActivityManager)this.getSystemService(ACTIVITY_SERVICE);
    myContext = this;
    this.loadTasks();

}
public void addItem(String processName, String processText)
{
    HashMap<String, String> item = new HashMap<String, String>();
    item.put("Process", processName);
    item.put("Name", processText);
    list.add(item);
}
public void loadTasks()
{
    try
    {
        List<ActivityManager.RunningAppProcessInfo> tasks = am.getRunningAppProcesses();
        int numOfTasks = tasks.size();
        for(int i = 0; i < numOfTasks; i++)
        {
            ActivityManager.RunningAppProcessInfo task = tasks.get(i);
            try
            {
                PackageInfo myPInfo = getPackageManager().getPackageInfo(task.processName, 0);
                addItem(task.processName, myPInfo.applicationInfo.loadLabel(getPackageManager()).toString());
            }
            catch (PackageManager.NameNotFoundException ne)
            {

            }
        }
    }
    catch (SecurityException se)
    {

    }
    SimpleAdapter notes = new SimpleAdapter(myContext, list, android.R.layout.simple_list_item_multiple_choice, new String[] {"Name", "Process"}, new int[] {android.R.id.text1, android.R.id.text2});
    setListAdapter(notes);
}
}

I have set all the permissions but still getting force close error please help.

  • 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-20T19:59:42+00:00Added an answer on May 20, 2026 at 7:59 pm

    change your perspective to DDMS and post some error log to tell us what kind of error is that. It’s important to look at the debug log to figure out what kind of errors you are facing.

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

Sidebar

Related Questions

I am trying to display all running apps on my android in a list
I am trying to display a list of all files found in the selected
I'm running magento 1.4 and I'm trying to display an overlayer banner on all
I'm trying to display all selected items from a listbox into a textbox. Currently
I'm trying to create a SharePoint web part that will display all the users
Trying to display current time with PHP (using this ): $date = date('m/d/Y h:i:s
I've been trying to display text using a Quartz context, but no matter what
I am trying to monitor all Java processes running on a server via jstatd.
Trying to use Zend_Search_Lucene to search a MySql database and display the results. Running
I'm running into some problems trying to understand how I can do this. Let's

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.