Example usage for android.widget ListView smoothScrollToPositionFromTop

List of usage examples for android.widget ListView smoothScrollToPositionFromTop

Introduction

In this page you can find the example usage for android.widget ListView smoothScrollToPositionFromTop.

Prototype

public void smoothScrollToPositionFromTop(int position, int offset) 

Source Link

Document

Smoothly scroll to the specified adapter position.

Usage

From source file:com.androidquery.simplefeed.fragments.FeedFragment.java

public void homeCb(String url, Feed feed, AjaxStatus status) {

    if (!isActive() || !url.equals(lastHome))
        return;// w  ww. j a v a  2  s. co m

    showProgress(false);

    if (feed != null) {

        showLogin(false);

        String next = feed.getNext();
        items.prepend(feed, next);
        items.setLoadable(next != null);

        if (status.expired(TEN_MIN)) {
            refresh();
        }

        act.updateTitle(status.getTime().getTime());
        aq.id(R.id.list).visible();

        if (act.isTablet() && items.getCount() > 0 && actionItem == null) {
            int index = findSelected(feed);
            actionItem = feed.get(index);
            ListView lv = aq.getListView();
            lv.smoothScrollToPositionFromTop(index, 0);
            showContentDetail(actionItem, true);
        }

    } else {

        int code = status.getCode();

        if (code != AjaxStatus.AUTH_ERROR) {
            askYesNo(act, getString(R.string.connection_failed), getString(R.string.retry) + "?",
                    getString(R.string.retry), getString(R.string.cancel));
        } else {
            showLogin(true);
        }
    }

}