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

  • Home
  • SEARCH
  • 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 8115709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:33:29+00:00 2026-06-06T03:33:29+00:00

I have a application that has an activity that shows message logs. The thing

  • 0

I have a application that has an activity that shows message logs. The thing is the user must to be able to select some messages and then delete them as you can do when you want to remove some sms messages.

Which is the best way of doing that? Adding more details:

Here is a capture with the messages only.

enter image description here

Here is a capture with the selection layout.

enter image description here

I want to know how they do it to show the CheckBoxes. Did they use two layouts?

  • 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-06-06T03:33:31+00:00Added an answer on June 6, 2026 at 3:33 am

    I wanna know how they do it to show the checkbox, does they use 2
    layouts?

    I doubt they use two layouts files. As the rows are very similar it very easy to switch from the layout that doesn’t have the CheckBox to the layout that does have the CheckBox just by changing the visiblity. A way to do it would be to have a flag in your adapter that indicates the presence of the CheckBox in the rows and update the CheckBox visibility based on that flag:

    boolean checkStatus = false;
    
    //...
    
    public void getView(int position, View convertView, ViewGroup parent) {
         //...
         if (checkStatus) {
              checkBox.setVisibility(View.VISIBLE); //show the CheckBox for each row
         } else {
              checkBox.setVisibility(View.GONE); // hide the CheckBox for each row
         }
         //...
    }
    

    Then when it’s time to show those CheckBoxes(on a Button click, menu click etc) you just have to set the checkStatus flag to the desired value(true for CheckBoxes present, false otherwise) and call notifyDataSetChanged() on your adapter.

    Of course you could use two layouts, one that contains the CheckBox and one that doesn’t have it. But, generally, you would use two layouts in a ListView when the two layouts are very(or substantial) different(which is not your case). To implement the two layouts you would have to use the methods getItemViewType and getViewTypeCount.

    boolean checkStatus = false;
    
    public int getViewTypeCount() {
         return 2; // you have two layouts
    }
    
    public int getItemViewType(int position) {
         if (checkStatus) {
              return 1;
         } else {
              return 0;
         }
    }
    

    Then in your getView method:

    public void getView(int position, View convertView, ViewGroup parent) {
         int which = getItemViewType(position)
         // make a switch statement and inflate the correct layout file
         // based on the which variable if the convertView is null
         // do stuff;
    }
    

    Of course when it’s time to show the CheckBoxes you would have to set the checkStatus flag again and call notifyDataSetChanged() on your adapter.

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

Sidebar

Related Questions

I have an Android application that contains two Activities . Activity A has a
I have an application that has two threads. The first one (the main thread)
i have an application that has a dependancy on gdiplus. i need the application
I have an application that has a list of buttons and has customized tooltips.
I have an application that has a .sql file in it. The sql file
We have an application that has a WCF service (*.svc) running on IIS7 and
I have an application that has a UILabel displaying the current date and time,
I have an application that has a status table see Database best practices -
I have an application that has a concept of a Venue , a place
We have an application that has a primary window, it can launch multiple other

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.