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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:03:21+00:00 2026-05-23T16:03:21+00:00

I created custom adapter like this public class SettingsAdapter extends BaseAdapter{ ArrayList<String> Noptions =

  • 0

I created custom adapter like this

public class SettingsAdapter extends BaseAdapter{

ArrayList<String> Noptions = new ArrayList<String>();
Context mContext;   
LayoutInflater inf;

public SettingsAdapter(Context c, ArrayList<String> options){
    this.mContext = c;
    this.Noptions = options;
    inf = LayoutInflater.from(mContext);
}

@Override
public int getCount() {
    return Noptions.size();
}

@Override
public Object getItem(int position) {
    return Noptions.get(position);
}

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

static class ViewHolder2{
    TextView name;
    CheckBox cb;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder2 holder;
    if(convertView == null){
        convertView = inf.inflate(R.layout.settings_row, null);
        holder = new ViewHolder2();
        holder.name = (TextView)convertView.findViewById(R.id.optionName);
        holder.cb = (CheckBox)convertView.findViewById(R.id.chooseOptionName);
        convertView.setTag(holder);
    }
    else{
        holder = (ViewHolder2)convertView.getTag();
    }

    holder.name.setText(Noptions.get(position).toString());

    holder.cb.setChecked(false);


    return convertView;
}

}

can someone explain to me how to get the text only in those rows where the check box is selected?!!!? any help will be very appreciated.

  • 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-23T16:03:22+00:00Added an answer on May 23, 2026 at 4:03 pm

    Please try below code

    @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder2 holder;
            if(convertView == null){
                convertView = inf.inflate(R.layout.settings_row, null);
                holder = new ViewHolder2();
                holder.name = (TextView)convertView.findViewById(R.id.optionName);
                holder.cb = (CheckBox)convertView.findViewById(R.id.chooseOptionName);
                convertView.setTag(holder);
            }
            else{
                holder = (ViewHolder2)convertView.getTag();
            }
    
            holder.name.setText(Noptions.get(position).toString());
    
            holder.cb.setChecked(false);
    
            holder.cb.setTag(Noptions.get(position).toString());
            holder.cb.setOnClickListener(new OnClickListener() {
    
                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    String txtvalue=  v.getTag().toString();
                    // toast "txtvalue" value
                }
            });
    
            return convertView;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have created a My custom listActivty by extending ListActivity like this. public class
I have created a custom listview and adapter by extending BaseAdapter. Every time I
I have a ListView with a custom list adapter (that extends BaseAdapter). My list
I've created a custom ListBox like in here . Thing is it doesn't raise
I have created custom attributes for a category in my module's install script like
I have created a viewmodel class for my custom view template. Right now I
I have the following class in my program: public class RZoom extends Activity {
Hello all I created a custom listview through my custom adapter.. CustomAdapter adapter =
I have created custom MembershipUser, MembershipProvider and RolePrivoder classes. These all work and I
I created a custom autocomplete control, when the user press a key it queries

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.