@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scrollview);

    // Create new PullToRefreshAttacher
    mPullToRefreshAttacher = PullToRefreshAttacher.get(this);

    // Retrieve the PullToRefreshLayout from the content view
    PullToRefreshLayout ptrLayout = (PullToRefreshLayout) findViewById(R.id.ptr_layout);

    // Give the PullToRefreshAttacher to the PullToRefreshLayout, along with the refresh
    // listener (this).
    ptrLayout.setPullToRefreshAttacher(mPullToRefreshAttacher, this);

    // As we haven't set an explicit HeaderTransformer, we can safely cast the result of
    // getHeaderTransformer() to DefaultHeaderTransformer
    DefaultHeaderTransformer ht =
        (DefaultHeaderTransformer) mPullToRefreshAttacher.getHeaderTransformer();

    // As we're using a DefaultHeaderTransformer we can change the text which is displayed.
    // You should load these values from localised resources, but we'll just use static strings.
    ht.setPullText("Swipe Me!!!");
    ht.setRefreshingText("Refreshing :)");
  }