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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:45:12+00:00 2026-05-28T18:45:12+00:00

Hello everyone i have a problem in my application. The check in my check

  • 0

Hello everyone i have a problem in my application. The check in my check box, once i check the check box and scroll it down/up the check is gone, i didn’t know how that happen. can anyone help me with this? THANKS for the help 🙂
HERE IS MY CODE:

public class TaskKiller extends Activity {
    private static final String TAG = "TaskKillerActivity";
    TaskListAdapter adapter;
    ListView lv;

    private List<TaskObject> getTasksToKill() {
        List<TaskObject> tol = new ArrayList<TaskObject>();

        for (int i = 0; i < adapter.getCount(); i++) {
            TaskObject to = adapter.getItem(i);
            if (to.isToKill()) {
                tol.add(to);
            }
        }

        return tol;
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

    }

    public void loadRunningProcesses() {

        ActivityManager activityManager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);

        List<RunningAppProcessInfo> appinfolist = activityManager
                .getRunningAppProcesses();

        Log.d(TAG, "AppInfoList Size: " + appinfolist.size());

        for (ActivityManager.RunningAppProcessInfo runningAppProcessInfo : appinfolist) {
            TaskObject runningtask = new TaskObject();
            runningtask.setPid(runningAppProcessInfo.pid);
            runningtask.setProcessName(runningAppProcessInfo.processName);
            adapter.addTask(runningtask);
        }
    }

    class TaskObject {
        int pid;
        String processName;
        private boolean toKill;

        public int getPid() {
            return pid;
        }

        public void setPid(int pid) {
            this.pid = pid;
        }

        public String getProcessName() {
            return processName;
        }

        public void setProcessName(String processName) {
            this.processName = processName;
        }

        public boolean isToKill() {
            return toKill;
        }

        public void setToKill(boolean toKill) {
            this.toKill = toKill;
        }

    }

    class TaskListAdapter extends BaseAdapter {

        private static final String TAG = "TaskListAdapter";

        ArrayList<TaskObject> list;
        Context context;

        public TaskListAdapter(Context context) {
            Log.d(TAG, "created new task list adapter");
            this.context = context;
            if (list == null) {
                list = new ArrayList<TaskKiller.TaskObject>();
            }
        }

        public void addTask(TaskObject taskObject) {
            list.add(taskObject);
        }

        public void clearTasks() {
            list.clear();
            Log.d(TAG, "list size:" + list.size());
            this.notifyDataSetChanged();
        }

        public int getCount() {
            return list.size();
        }

        public TaskObject getItem(int position) {
            return list.get(position);
        }

        public long getItemId(int position) {
            return position;
        }

        public View getView(final int position, View convertView,
                ViewGroup parent) {
            RelativeLayout rl = new RelativeLayout(context);
            TextView textPid = new TextView(context);
            textPid.setId(222222);
            textPid.setText(Integer.toString(getItem(position).getPid()));

            TextView textName = new TextView(context);
            textName.setId(333333);
            textName.setText(getItem(position).getProcessName());

            CheckBox chckKill = new CheckBox(context);
            chckKill.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                    // is chkIos checked?
                    if (((CheckBox) v).isChecked()) {
                        getItem(position).setToKill(true);
                    }

                }
            });
}
  • 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-28T18:45:13+00:00Added an answer on May 28, 2026 at 6:45 pm

    I think the issue is that you aren’t using the item’s toKill status into the Checkbox. When you scroll, it get’s redrawn with getView – and is reset to empty.

    add

    chckKill.setChecked( ((TaskObject) getItem(position) ).isToKill());
    

    after the constructor.

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

Sidebar

Related Questions

hello everyone i have a problem with my 3-tiers application i don't know how
Hello everyone~ I have a problem to solve~ I have created a server that
Hello everyone I have a problem I'll try to describe shortly In our application
Hello everyone I have a problem. I'm trying to upload my application in the
So hello everyone I have a big problem right now with a button that
Hello everyone I am new to blackberry and I want a textfield that scroll
Hello everyone I have converted a project in C# to F# that paints the
hello everyone I have some problem with understanding this piece of the code: import
Hello everyone I have some problem to grab movie title with regular expression. how
Hello everyone and thanks in advance. I have a problem and I have 2

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.