我在行setOnRefreshListener中标记错误

时间:2015-01-08 01:05:07

标签: android

me marca este error类型PullToRefreshListView中的方法setOnRefreshListener(PullToRefreshListView.OnRefreshListener)不适用于参数(活动)

我的代码就是这个

private class ListViewPagerAdapter extends PagerAdapter {

    @Override
    public View instantiateItem(ViewGroup container, int position) {
        Context context = container.getContext();

        PullToRefreshListView plv = (PullToRefreshListView) LayoutInflater.from(context).inflate(
                R.layout.layout_listview_in_viewpager, container, false);

        ListAdapter adapter = new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1,
                Arrays.asList(STRINGS));
        plv.setAdapter(adapter);

        plv.setOnRefreshListener(activity.this);

        // Now just add ListView to ViewPager and return it
        container.addView(plv, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

        return plv;
    }

0 个答案:

没有答案