auto hides keyboard after scrolling ListView on android

It is better to use onScrollStateChanged instead of onScroll and by using scrollState == 0. So keyboard will hide when user is really scrolling.

listview.setOnScrollListener(new AbsListView.OnScrollListener() {

        @Override
        public void onScrollStateChanged(AbsListView view,
                                         int scrollState) {

            if (scrollState == 0) {
                InputMethodManager inputMethodManger = (InputMethodManager) getActivity().getSystemService(Activity
                        .INPUT_METHOD_SERVICE);
                inputMethodManger.hideSoftInputFromWindow(view.getWindowToken(), 0);
            }
        }

        @Override
        public void onScroll(AbsListView view, int firstVisibleItem,
                             int visibleItemCount, int totalItemCount) {


        }
    });

Try this..

why don't you use OnTouchListener for ListView like below

lvCustomList.setOnTouchListener(new OnTouchListener() {
    @Override
        public boolean onTouch(View v, MotionEvent event) {

            InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(edittext.getWindowToken(), 0);

        return false;
    }
});