If someone has the same issue, I fixed it now. Just switched the setOnCheckedChangeListener rows with the setChecked call and now it's just working fine. Even though I don't understand that issue. ^^
Best regards Tobi On 7 Apr., 11:48, grevenilvec <greven...@googlemail.com> wrote: > I have a big Problem with my Listview and its Checkboxes... Every > thing is shown and works fine, until I click on one of the Checkboxes. > Then other Boxes are checked and sometimes even without checking the > one, I clicked. > I searched the web, but didn't find a solution that is working. Now > I'm hoping, someone of you, Guys, would be able to help to solve my > problem. > > Enclosed is the Code of my Customadapter, which is used for filling > the list. > > package org.openintents.filemanager; > > import java.util.ArrayList; > > import android.content.Context; > import android.view.LayoutInflater; > import android.view.View; > import android.view.ViewGroup; > import android.view.View.OnClickListener; > import android.widget.BaseAdapter; > import android.widget.CheckBox; > import android.widget.CompoundButton; > import android.widget.TextView; > import android.widget.CompoundButton.OnCheckedChangeListener; > > public class CustomSettingsAdapter extends BaseAdapter{ > > private static ArrayList<SettingItem> settingsArrayList; > private LayoutInflater mInflater; > > public CustomSettingsAdapter(Context context, ArrayList<SettingItem> > sitems) > { > settingsArrayList = sitems; > mInflater = LayoutInflater.from(context); > } > > public int getCount() > { > return settingsArrayList.size(); > } > > public Object getItem(int position) > { > return settingsArrayList.get(position); > } > > public ArrayList<SettingItem> getItemList() > { > return settingsArrayList; > } > > public long getItemId(int position) > { > return position; > } > > public View getView(final int position, View convertView, ViewGroup > parent) { > final ViewHolder holder; > if (convertView == null) > { > convertView = mInflater.inflate(R.layout.settings_item, null); > holder = new ViewHolder(); > holder.txtName = (TextView) > convertView.findViewById(R.id.setting_name); > holder.details = (TextView) > convertView.findViewById(R.id.setting_detail); > holder.cb = (CheckBox) convertView.findViewById(R.id.check); > convertView.setTag(holder); > } > else > { > holder = (ViewHolder) convertView.getTag(); > } > > holder.txtName.setText(settingsArrayList.get(position).getName()); > holder.details.setText(settingsArrayList.get(position).getPath()); > holder.cb.setChecked(settingsArrayList.get(position).getState()); > int[]tags = new int[2]; > tags[0]= position; > tags[1]= 0; > holder.cb.setTag(tags); > > holder.cb.setOnCheckedChangeListener(new OnCheckedChangeListener() { > > @Override > public void onCheckedChanged(CompoundButton buttonView, boolean > isChecked) { > > int[]i=(int[])holder.cb.getTag(); > settingsArrayList.get(i[0]).setState(isChecked); > notifyDataSetChanged(); > } > }); > > return convertView; > } > > static class ViewHolder > { > TextView txtName; > TextView details; > CheckBox cb; > } > > } > > Thank you very much in advance for helping. > Best regards > Tobi -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en