omadahealth / SwipyRefreshLayout

A SwipeRefreshLayout extension that allows to swipe in both direction
MIT License
963 stars 218 forks source link

setRefreshing(true) after onCreate is not working #34

Closed maniacs-engineerica closed 8 years ago

maniacs-engineerica commented 8 years ago

I am trying to make an http connection immediately after activity onCreate to show my data. While the request is processing I want to show the refreshing in true, but it doest work at this moment. How to solve that?

You can try with your example adding a "mSwipyRefreshLayout.setRefreshing(true);" in initLayout() method on MainActivity class.

Thanks!

maniacs-engineerica commented 8 years ago

I found the reason of this. We have to wait until SwipyRefreshLayout executes onMeasure method.

oliveeyay commented 8 years ago

Yes you probably have to wait for the component to be init. You can post a runnable on the view too.

IslamSalah commented 5 years ago

Posting a runnable 👍

mSwipeRl.post(() -> mSwipeRl.setRefreshing(true));