Question

faced with a problem using code from here. When a phone has a landscape orientation not all list items are visible (let's asume I see only 3 of 5). When I scroll down to 4th and 5th elements I see again two 1st elements (i.e. 1,2,3,1,1). After some scroll actoins I get more interesting mix (like 2,3,1,2,1) and so on.

The code is as was in the link, everything I changed didn't fix a problem. What's wrong?

Thanks in advance

2Rajath Thank you for the simple example, but I cannot apply it to my case. Please have a look

@Override
    public View getView(final int position, View convertView, ViewGroup parent){
        View row;
        if(convertView == null){            
            row = mInflater.inflate(R.layout.custom_list_preference_row, parent, false);
        } else {
            row = convertView;
        }
        CustomHolder holder = new CustomHolder(row, position);
        row.setTag(holder);
        return row;
    }

When CustomHolder object is created it throws NullPointer exception at setId() method

class CustomHolder
    {
        private RadioButton rButton = null;

        CustomHolder(View row, int position){    
            rButton = (RadioButton)row.findViewById(R.id.custom_list_view_row_radio_button);
            rButton.setId(position);

            rButtonList.add(rButton);
    }
}

Could you please explain how to make this code work?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top