I am curious what you mean by "make sure you have the states of the
views set up correctly". In my original implementation, I was using
the convertView in the manner I thought was correct. i.e.
View v = convertView;
if (v == null) {
LayoutInflater vi =
(LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.list_view_row, null);
}
Assuming this is what you meant, I don't get what view states I was
failing to set up that resulted in my seemingly "random" spinner
appearing in the list. I had a text view and an image view for each
row, and in each case, I set the text view and image view to the
correct value for what I wanted to display.
TextView label = (TextView) v.findViewById(R.id.label);
ImageView spinner = (ImageView) v.findViewById(R.id.spinner);
MyContainer item = (MyContainer) items.get(position);
if (item.isLoading()) {
label.setText("***"+item.getText()+"***");
spinner = (ImageView)v.findViewById(R.id.spinner);
spinner.setVisibility(View.VISIBLE);
Animation spinnerAnimation =
AnimationUtils.loadAnimation(getContext(), R.anim.rotate);
spinner.startAnimation(spinnerAnimation);
} else {
label.setText(item.getText());
spinner.setVisibility(View.INVISIBLE);
}
return v;
The row in my list adversely affected, was never the one where I saw
this code being invoked. What is it I should have done to my view v
before returning? Thanks in advance for your response. While I am
not seeing any issue yet re-inflating each time, I'd also like to do
this the way the framework intended if I can.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en