Note that there are some explanatory texts on larger screens.

plurals
  1. POListview showing wrong view for a few seconds while flinging and scrolling
    text
    copied!<p>The system seems to be recycling views until it loads the correct position's view in my listview, resulting in duplicated images and text for a few seconds. Can anyone help?</p> <pre><code>@Override public View getView(final int position, View convertView, ViewGroup parent) { View v = convertView; Log.d("position",""+position); if(v==null){ LayoutInflater inflater = LayoutInflater.from(mContext); v = inflater.inflate(R.layout.layout_appinfo, null); holder = new ViewHolder(); holder.ivAppIcon = (ImageView)v.findViewById(R.id.ivIconApp); holder.tvAppName = (TextView)v.findViewById(R.id.tvNameApp); holder.progress = (ProgressBar)v.findViewById(R.id.progress_spinner); v.setTag(holder); } else { holder = (ViewHolder) v.getTag(); } holder.ivAppIcon.setImageDrawable(null); holder.tvAppName.setText(null); holder.progress.setVisibility(View.VISIBLE); holder.ivAppIcon.setVisibility(View.GONE); // Using an AsyncTask to load the slow images in a background thread new AsyncTask&lt;ViewHolder, Void, Drawable&gt;() { private ViewHolder v; private ResolveInfo entry = (ResolveInfo) mListAppInfo.get(position); @Override protected Drawable doInBackground(ViewHolder... params) { v = params[0]; return entry.loadIcon(mPackManager); } @Override protected void onPostExecute(Drawable result) { super.onPostExecute(result); // If this item hasn't been recycled already, hide the // progress and set and show the image v.progress.setVisibility(View.GONE); v.ivAppIcon.setVisibility(View.VISIBLE); v.ivAppIcon.setImageDrawable(result); v.tvAppName.setText(entry.loadLabel(mPackManager)); } }.execute(holder); return v; } static class ViewHolder { TextView tvAppName; ImageView ivAppIcon; ProgressBar progress; //int position; } </code></pre> <p>It is almost as if the position is being set wrong for a few seconds.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload