I'm developing an app with a form users will have to fill. The form has some textview, edittexts, a listview and two buttons.
The listview consist of a textview and two radiobuttons. I populate the listview with a question and two radiobuttons in every row. If I reuse the convertview given in overriden getView method, when I check a radiobutton, it will check the first radiobutton visible while scrolling down as per every screen scrolled.
@Override
public View getView(int position, View convertView, ViewGroup parent){
if(convertView == null){
convertView = ((Activity)context).getLayoutInflater().inflate(R.layout.riskrowlayout, parent, false);
}
((TextView)convertView.findViewById(R.id.tvPreg)).setText(data.get(position));
return convertView;
}
Otherwise, if I inflate the layout everytime getView gets called, it will automatically uncheck the radiobutton I checked while scrolling.
@Override
public View getView(int position, View convertView, ViewGroup parent){
convertView = ((Activity)context).getLayoutInflater().inflate(R.layout.riskrowlayout, parent, false);
((TextView)convertView.findViewById(R.id.tvPreg)).setText(data.get(position));
return convertView;
}
What I'm doing wrong? How can I solve this? If you need more info ask and I'll give you.
Thank you very much in advantage!
Problem from last comment solved, just pasted this code from another post:
@Override
public int getViewTypeCount() {
return getCount();
}
@Override
public int getItemViewType(int position) {
return position;
}