How to use the SwipeRefreshLayout?

I don’t know what that ActionBarActivity class you’re extending is, but I got it working just fine using a FragmentActivity public class ActivityMain extends FragmentActivity implements OnRefreshListener { private SwipeRefreshLayout mSwipeRefreshLayout; @Override protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.container); mSwipeRefreshLayout.setOnRefreshListener(this); super.onCreate(savedInstanceState); } @Override public void onRefresh() { Toast.makeText(this, “Refresh”, Toast.LENGTH_SHORT).show(); new Handler().postDelayed(new … Read more

SwipeRefreshLayout behind ActionBar

In the Material Design version of the appcompat-v7 library (v21.0.0), SwipeRefreshLayout gets a method to set the Progress View offset. https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html#setProgressViewOffset(boolean,%20int,%20int) public void setProgressViewOffset (boolean scale, int start, int end) The refresh indicator starting and resting position is always positioned near the top of the refreshing content. This position is a consistent location, but can … Read more

SwipeRefreshLayout + WebView when scroll position is at top

I’ve managed to solve it without having to extend anything. Have a look at this snippet (Fragment-specific): private ViewTreeObserver.OnScrollChangedListener mOnScrollChangedListener; @Override public void onStart() { super.onStart(); swipeLayout.getViewTreeObserver().addOnScrollChangedListener(mOnScrollChangedListener = new ViewTreeObserver.OnScrollChangedListener() { @Override public void onScrollChanged() { if (mWebView.getScrollY() == 0) swipeLayout.setEnabled(true); else swipeLayout.setEnabled(false); } }); } @Override public void onStop() { swipeLayout.getViewTreeObserver().removeOnScrollChangedListener(mOnScrollChangedListener); super.onStop(); } For … Read more

How to set SwipeRefreshLayout refreshing property using android data binding?

No need to hack. The key is to look for the public methods in SwipeRefreshLayout documentation. In general, Databinding will look for the corresponding name without the set part. E.g. you’ll find there: setOnRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) setRefreshing(boolean refreshing) The OnRefreshListener Since OnRefreshListener is a public interface, with a single method, you can directly use this in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)