Help us understand the problem. What is going on with this article?

ActionBar-PullToRefresh使ってみたメモ

More than 5 years have passed since last update.

ListView使いたかったのサンプルコード拝借してきて、こんなかんじのかけば多分動くんじゃね程度のメモコード

メモコード

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        SampleListFragment sampleFragment = new SampleListFragment();
        if (sampleFragment != null) {
            getFragmentManager().beginTransaction()
                    .replace(android.R.id.content, sampleFragment).commit();
        }
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }


}
public class SampleListFragment extends ListFragment implements OnRefreshListener {

    private PullToRefreshLayout mPullToRefreshLayout;

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view,savedInstanceState);
        ViewGroup viewGroup = (ViewGroup) view;

        mPullToRefreshLayout = new PullToRefreshLayout(viewGroup.getContext());

        ActionBarPullToRefresh.from(getActivity())
                .insertLayoutInto(viewGroup)
                .theseChildrenArePullable(android.R.id.list, android.R.id.empty)
                .listener(this)
                .setup(mPullToRefreshLayout);

    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

    }

    @Override
    public void onRefreshStarted(View view) {
       // do some stuff...
       mPullToRefreshLayout.setRefreshComplete();
    }
}

ActionBar-PullToRefresh

このへんのサンプル見ると他のviewでの実装もわかりやすくてよいかも

This is a Preview

っていうてるのでAPIはまだこれから変わる可能性あるのでちょと気をつけないと

freee
スモールビジネスのバックオフィス業務をテクノロジーで自動化し、日本のスモールビジネスを元気にする
http://www.freee.co.jp/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away