我正在尝试使用swipeRefreshLayout更新数据,但每次向下滑动以刷新它都会重复旧的而不是显示新数据.
你可以帮我解决这个问题并告诉我我在哪里弄错了以及如何解决它.
片段中的代码:
public class StoriesFragment extends Fragment {
private static final String TAG = MainActivity.class.getSimpleName();
private static final String url = "http://sho3a3.net/storiesfeed.json";
private ProgressDialog pDialog;
private List<StoriesItem> storiesListItem = new ArrayList<StoriesItem>();
private ListView storiesListView;
private CustomListAdapter adapter;
private SwipeRefreshLayout swipeRefreshLayout;
public StoriesFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.stories_fragment, container, false);
/*Swipe Refresh Layout*/
swipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipe_container); …Run Code Online (Sandbox Code Playgroud)