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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:59:17+00:00 2026-05-26T22:59:17+00:00

I have an application with three textviews and one checkbox in each row of

  • 0

I have an application with three textviews and one checkbox in each row of a listview.what I want that on a click of a button I will be able to get the state of each checkbox and the row corresponding to (isChecked) checkboxes get deleted.one more thing my checkboxes are hardcoded in an xml file.I have searched a lot but couldn’t find anything specific.thanks in advance.HERE IS MY CODE…

  public class recentcalllistultimate extends ListActivity implements OnClickListener {
            CheckBox cb;
            Button edit,done;

            ImageButton contacts;
            ListView lv;
            ListView lvultimate;
            listviewadapterultimate lvar;


            int[] uniqueid;
            String[] names;
            String[] types;
            ;
        RelativeLayout rl;
            @Override
            protected void onCreate(Bundle savedInstanceState) {
                // TODO Auto-generated method stub
                super.onCreate(savedInstanceState);

        LayoutParams params=newRelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
                LinearLayout mainLayout = new LinearLayout(this);
                mainLayout.setOrientation(LinearLayout.VERTICAL);
                LayoutInflater layoutInflater = getLayoutInflater();
                mainLayout.addView(layoutInflater.inflate(R.layout.listviewonly, null));
                mainLayout.addView(layoutInflater.inflate(R.layout.allbuttons, null));
                this.addContentView(mainLayout, params);

                cb = (CheckBox) findViewById(R.id.checkboxdelete);

                getContacts();

                lv = (ListView) findViewById(android.R.id.list);
                lvar = new listviewadapterultimate(this, names, types,uniqueid);
                lv.setAdapter(lvar);

                contacts = (ImageButton) findViewById(R.id.button_keypad);
                contacts.setOnClickListener(this);

                edit = (Button) findViewById(R.id.editbutton);
                done=(Button)findViewById(R.id.donebutton);

                done.setOnClickListener(new View.OnClickListener() {



    ------>>>                          public void onClick(View v) {
                        // TODO Auto-generated method stub
          cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {

                public void onCheckedChanged(CompoundButton buttonView, booleanisChecked) {
                                // TODO Auto-generated method stub

                               //WHAT TO DO HERE....        

                                }

                            }
                        });
                    }
     ------>>>          });


    edit.setOnClickListener(new View.OnClickListener() {

                    public void onClick(View v) {
                        // TODO Auto-generated method stub

                        AddDialog ada=new AddDialog(recentcalllistultimate.this);
                        ada.show();
                    }
                });

        }// on create

            public void getContacts() {

                ContentResolver cr = getContentResolver();

                Cursor cur = cr.query(android.provider.CallLog.Calls.CONTENT_URI, null,
                        null, null, null);

                if (cur.getCount() > 0) {
                    int i = 0;
                    int foo = 0;
                    names = new String[cur.getCount()];
                    types = new String[cur.getCount()];
                    duration = new long[cur.getCount()];
                    uniqueid = new int[cur.getCount()];

                    int n = cur.getColumnIndex(CallLog.Calls._ID);
                    int k = cur.getColumnIndex(CallLog.Calls.CACHED_NAME);
                    int y = cur.getColumnIndex(CallLog.Calls.NUMBER);
                    int z = cur.getColumnIndex(CallLog.Calls.CACHED_NUMBER_TYPE);


                    while (cur.moveToNext()) {

                        uniqueid[foo] = cur.getInt(n);

                        String str = cur.getString(k);

                        if (str == null) {
                            names[foo] = cur.getString(y);
                        }// if
                        else {
                            names[foo] = str;
                        }

                        int temp = cur.getInt(z);
                        switch (temp) {
                        case 0:
                            types[foo] = "unknown";
                            break;
                        case 1:
                            types[foo] = "home";
                            break;
                        case 2:
                            types[foo] = "mobile";
                            break;
                        case 3:
                            types[foo] = "work";
                            break;
                        }// switch

                        long doo = cur.getInt(d);
                        duration[foo] = doo;

                        foo++;

                    } // while
                }// if

            }//getcontacts

            public void onClick(View v) {
                // TODO Auto-generated method stub
                if(v==contacts){
                Intent intent = new Intent();
                intent.setClassName("com.a.Activities",
                        "com.a.Activities.DialPad");
                startActivity(intent);
                finish();
                }
                }

     }// class
        .................................

        public class listviewadapterultimate extends BaseAdapter {
            viewHolder holder;

            Activity context;
            String[] names;
            String[] types;
            String[] duration;
            int[] uniqueid;


            public listviewadapterultimate(Activity context, String[] names,
                    String[] types, int[] uniqueid2 ) {
                this.context = context;
                this.names = names;
                this.types = types;

                uniqueid=uniqueid2;

            }




            public int getCount() {
                // TODO Auto-generated method stub
                return names.length;
            }

            public Object getItem(int position) {
                // TODO Auto-generated method stub
                return null;
            }

            public long getItemId(int position) {
                // TODO Auto-generated method stub
                return 0;
            }

            public class viewHolder {
                TextView top;
                TextView bottom;

                TextView down;


            }

            public View getView(int position, View convertView, ViewGroup parent) {
                // TODO Auto-generated method stub



                if (convertView == null) {
                    holder = new viewHolder();
                    LayoutInflater inflator = context.getLayoutInflater();
                    convertView = inflator.inflate(R.layout.recenttextviewonlyultimate, null);
                   holder.top = (TextView) convertView.findViewById(R.id.toptext_u);
                    holder.bottom = (TextView) convertView
                            .findViewById(R.id.bottomtext_u);

                holder.down = (TextView) convertView.findViewById(R.id.recentuniqueid_u);

                convertView.setTag(holder);

                } else {
                    holder = (viewHolder) convertView.getTag();
                    //holder.cb.setVisibility(View.VISIBLE);
                }

                holder.top.setText(names[position]);
                holder.bottom.setText(types[position]);

                holder.down.setText("" + uniqueid[position]);


                return convertView;
            }

        }
        ................
  • 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-26T22:59:17+00:00Added an answer on May 26, 2026 at 10:59 pm

    Try this:

    Inside your getView(…) method…

     final CheckBox lChk = ((CheckBox) pConvertView.findViewById(R.id.myChkBoxID)); 
     private List<lisInfo> m_lisInfo = new ArrayList<lisInfo>();
    
     lChk.setOnCheckedChangeListener(new OnCheckedChangeListener() {
         @Override
         public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
         // Populate the listInfo with check box status
         m_lisInfo.get(lPosition).setChkBoxStatus((isChecked));
      }
     });
    
    
     public class lisInfo{
       private boolean chkBoxStatus;
    
       public boolean isChkBoxStatus() {
            return chkBoxStatus;
        }
    
        public void setChkBoxStatus(boolean chkBoxStatus) {
            this.chkBoxStatus = chkBoxStatus;
        }
    }
    

    Now iterate the listInfo wherever required to get the check boxes statuses in the list view

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

Sidebar

Related Questions

I have PHP application that contain three small applications. Each application have own users
I have a web application. It is separated into three sections, each with its
I have a Java swing application with a panel that contains three JComboBoxe s
I have three applications that talk to each other using sockets. They can all
My application have three pages (three tabs) and I want to switch beetween two
I have three web application projects that share a common library of custom server
In my application I have a single EditText together with some TextViews , button
As the title describes it. We have an application that atm shows three possible
I have created one application in which if i select on particular row in
I have an application with three layers (Presentation, Business Logic, and Data Access). In

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.