I try to trigger swipeRefreshLayout indicator when my app run but it's not triggered! I have listView with my custom Adapter, I load JSON from an URL and set it in my listView, I want to show loading indicator at first run. I try these ways: 1.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main, container, false);
swipeContainer = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeContainer);
swipeContainer.setOnRefreshListener(this);
//it's not working!
swipeContainer.setRefreshing(true);
return rootView;
}
2.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
// It's not working!!
swipeContainer.setRefreshing(true);
}
Note: I'm sure my SwipeRefreshLayout is fine because on onStart or onRefresh method worked currently.
Any solution appreciated :)