I am writing an custom list, in which displayed 3rd list item has toggle button as an child. On toggle button click it launch an confirmation dialog, if wants toggle button or not.
Now if list not scrolled then it work perfect. But if scroll list(so 3rd displayed as 1st item) then button toggle state(for toggleButton.setChecked(false)
) not working after Dialog-Cancel
action.
Any suggestion if I am missing anything.
EDIT
public View getView(int position, View convertView, ViewGroup parent) {
View vi = convertView;
if(convertView == null) {
vi = inflater.inflate(R.layout.setting_prefernce_row, parent, false);
final ViewHolder viewHolder = new ViewHolder();
viewHolder.title = (TextView)vi.findViewById(R.id.txtPreferenceName); // Preference Name
viewHolder.txtPreferenceSub = (TextView)vi.findViewById(R.id.txtPreferenceSub); // Sub-Preference Name
viewHolder.txtArrow = (TextView)vi.findViewById(R.id.txtArrow); // text before arrow
viewHolder.imgArrow = (ImageView)vi.findViewById(R.id.imgArrow); // right_arrow
viewHolder.btnToggleState = (ToggleButton)vi.findViewById(R.id.tglToggleState); // toggle button
viewHolder.switchTemperatureUnit = (ImageView)vi.findViewById(R.id.switchTemperatureUnit); // switch button for temperature
//viewHolder.checkbox.setTag(list.get(position));
//viewHolder.scores.setTag(list.get(position));
vi.setTag(viewHolder);
} else {
vi = convertView;
}
....
}