Smoothing is not there in android listview scrolling, like whatsapp new chat contact list does


I have my listview with 1 image view and 2 text views but when I scroll it down it don't work smooth, so what should I do??

Now here is my code..

class ReceiptAdapter extends BaseAdapter { ArrayList<GetterSetter> receiptlist; private LayoutInflater inflater; // private int[] colors = new int[] { Color.parseColor("#C8A6DA"), // Color.parseColor("#F6F4AB"), Color.parseColor("#A2C3D0"), // Color.parseColor("#F1B4A1") }; private int[] colors = new int[] { Color.parseColor("#2280aee3"), Color.parseColor("#22888888") }; public ReceiptAdapter(Context context, ArrayList<GetterSetter> receiptlist) { // TODO Auto-generated method stub this.receiptlist = receiptlist; // inflater = LayoutInflater.from(context); // inflater = LayoutInflater.from(context.getApplicationContext()); inflater = (LayoutInflater) getActivity().getSystemService( Context.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { // TODO Auto-generated method stub return receiptlist.size(); } @Override public Object getItem(int arg0) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { // TODO Auto-generated method stub ViewHolder holder = null; if (convertView == null) { // convertView = inflater.inflate(R.layout.custom_list, null); convertView = inflater.inflate(R.layout.custom_list, parent, false); // if (position % 2 == 1) { // convertView.setBackgroundColor(Color.BLUE); // } else { // convertView.setBackgroundColor(Color.CYAN); // } int colorPos = position % colors.length; convertView.setBackgroundColor(colors[colorPos]); holder = new ViewHolder(); holder.Title = (TextView) convertView.findViewById(R.id.name); holder.Total = (TextView) convertView.findViewById(R.id.total); holder.Img = (ImageView) convertView .findViewById(R.id.profile_image); Animation animation = null; animation = AnimationUtils.loadAnimation(getActivity(), R.anim.wave); animation.setDuration(200); convertView.startAnimation(animation); animation = null; convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.Title.setText(receiptlist.get(position).getTitle()); holder.Total.setText(receiptlist.get(position).getTotal()); String path = receiptlist.get(position).getImg(); File fileImg = new File(path); Bitmap bitmap = null; if (fileImg.exists()) { BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 7; bitmap = BitmapFactory.decodeFile(fileImg.getAbsolutePath(), options); // bitmap = BitmapFactory.decodeFile(fileImg.getAbsolutePath()); holder.Img.setImageBitmap(bitmap); } else { Bitmap icon = BitmapFactory.decodeResource(getActivity().getResources(), R.drawable.no_image); holder.Img.setImageBitmap(icon); } holder.Img.setScaleType(ScaleType.CENTER_CROP); return convertView; } class ViewHolder { TextView Title; TextView Total; ImageView Img; } }

and my async task in which in postExecute() I am calling the custom list adapter as,

ReceiptAdapter adapter = new ReceiptAdapter(getActivity(), recList); setListAdapter(adapter);

So, my question is where am I getting wrong?

Like in whatsapp though in contact list, it loads images and shows in image view, I am getting images from sd card and showing in image view, so why the scroll view can't work smoothly?

Whats should I implement for that?

I have searched many code also on stackoverflow, too but I found the same errors of others but didn't get any good feasible solution, so if anybody could help me out in this, then it would be appreciated. Thanks a tone!


You need load Images in background, not in the main thread. For this purpose you should use a library that handle that. Best libraries for that are:

<ul><li>Picasso <a href="http://square.github.io/picasso/" rel="nofollow">http://square.github.io/picasso/</a></li> <li>Universal image download <a href="https://github.com/nostra13/Android-Universal-Image-Loader" rel="nofollow">https://github.com/nostra13/Android-Universal-Image-Loader</a></li> </ul>

After implement one of this libraries you should use this for loading image in background, this libraries cache images in memory and handle other options, like placeholder for error dowwload, apply animation for showing images etc.

Sorry for my bad english


Or you could use Volley - this is the standard REST library from Google that is also capable of image loading. The Docs are <a href="https://developer.android.com/training/volley/request.html" rel="nofollow">here</a>


  • IOS UICollectionView with ScrollView
  • Background size getting changed
  • memory leak in cell with UILabel with ARC
  • ClassCast Expcetion in Bar char using MPAndroidChart jar
  • UITableView and CALayer confusion
  • Can I propagate an event from a label to an anchor link without javascript?
  • Can I propagate an event from a label to an anchor link without javascript?
  • Cannot align webview image in centre of a dialog
  • calling onActivityResult from CustomArray adapter
  • Plotting multiple corrplots (R) in the same graph
  • Animate selected item in MvxRecyclerView
  • How to create a window in smalltalk
  • Windows Phone Xaml: Force square proportioned container (aspectratio 1:1)
  • Android: ListAdapter example redraws same content
  • VBA, TRIM part of a Path
  • ContextCompat.getcolor() going to null object reference
  • getting data from edittext placed in listview
  • Change Background on a specific row based on a condition in Custom Adapter
  • What other Adapters can I use for ListView?
  • List view crashes when scrolling “The application may be doing too much work on its main thread.”
  • Listview with multiple strings
  • Drag and Drop for imageview not working
  • Is the listview recycling early? Or is Universal ImageLoader canceling in error? Or is my Logic wron
  • Picasso Taking time to load images
  • UIButton Borders Function Only Gives Back White Borders
  • Galaxy S4 Android Custom Camera Issue
  • Activity overlaying. WindowManager.LayoutParams
  • Responsive left sidebar open close
  • How to Make a Spinner (In a Fragment) That Changes the App's Language?
  • Syntax error on tokens, AnnotationName expected instead - error on query
  • WPF version of .ScaleControl?
  • Android Activity.onWindowFocusChanged doesn't get called from within TabHost
  • Force show.bind execution
  • How to modify the colors in the legend of a plot using a fill gradient?
  • Disable Enter in editText android
  • jquery mobile loadPage not working
  • align graphs with different xlab
  • Linking SubReports Without LinkChild/LinkMaster
  • Easiest way to encapsulate a HTML5 webpage into an android app?
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize