Skip to content Skip to sidebar Skip to footer

"getview" - The Constant Change Of Position Of Items And I Have To Click Twice Of "item"

I have a realization of ArrayAdapter (extends ArrayAdapter), the method getView constantly redraw the screen,constantly changing position item of the ListView. But this is not the

Solution 1:

You're not doing anything with your views when they are recycled (i.e. when convertView != null). You need to do any position-specific stuff after obtaining the viewHolder. Try something more along these lines:

if (convertView == null) {

    convertView = inflater.inflate(R.layout.database_table_item, null);
    viewHolder = new ViewHolder();

    viewHolder.text = (TextView) convertView
            .findViewById(R.id.editText1);

    viewHolder.text.setOnClickListener(new OnClickListener() {
        public void onClick(View v) {                   


            int getPosition = (Integer) v.getTag();
        }
    });

    convertView.setTag(viewHolder);

} else {
    viewHolder = (ViewHolder) convertView.getTag();
}

viewHolder.text.setTag(position);
viewHolder.text.setText(urlItem.getUrl());

return convertView;

Post a Comment for ""getview" - The Constant Change Of Position Of Items And I Have To Click Twice Of "item""