I have a very simple Activity that extends ListActivity. I am overriding the method onListItemClick do perform some custom operations.
What I have seen in the logs is that the adapter methode getView
is called after I click a list item (which I am overriding too in order to get my list made up by custom views).
Now, I would like to know if this is the correct behavior or not. If it is I might have a problem.
The problem is that my list items have images, those are fetched from web and when I click on a list item, the call to the adapter causes calls to the web refreshing the images in the list and messing them up fro some reason.
Can anyone shade some light?
this is my getView
:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ContentListItemView cv = null;
if (convertView == null) {
LayoutInflater inflater = LayoutInflater.from(this.context);
convertView = (RelativeLayout) inflater.inflate(this.layout, null);
cv = new ContentListItemView(convertView);
} else {
cv = (ContentListItemView) convertView.getTag();
}
Log.d(this.getClass().getSimpleName(), "position: " + position);
cv.init(getItem(position));
convertView.setTag(cv);
return convertView;
}
and this is my OnListItemClick
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
//Log.d(this.getClass().getSimpleName(), position + " " + id);
Intent contentDetailsIntent = new Intent(this, ContentDetailsActivity.class);
contentDetailsIntent.putExtra("com.tamtamy.jatta.content_list_item_selected", position);
contentDetailsIntent.putExtra("com.tamtamy.jatta.datasource", ContentDetailsActivity.CONTENT_LIST);
contentDetailsIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(contentDetailsIntent);
}