Menu
  • HOME
  • TAGS

SwipeRefreshLayout behind ActionBar

android,swiperefreshlayout

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...

SwipeRefreshLayout & RxAndroid subscribeOn(AndroidSchedulers.mainThread()) not working

android,retrofit,swiperefreshlayout,rx-android

Use subscribeOn to specify on which Thread you should make your Observable actions. If you want your observers to be notified on a specific thread, you should use .observeOn(AndroidSchedulers.mainThread()).

list view in fragments null pointer exception

java,android,android-fragments,android-listview,swiperefreshlayout

Your recent_list is null and you are referencing it outside the onCreateView inside your RecentsCardFragment, this is why the NullPointerException happenning. Move your recent_list declaration into your onCreateView method, like this: public class RecentsCardFragment extends Fragment implements SwipeRefreshLayout.OnRefreshListener { ListView recentsList; private SwipeRefreshLayout refreshBooks; ArrayList<HashMap<String,String>> items = new ArrayList<>(); //private...

Toolbar not showing with swipe to refresh

android,android-recyclerview,swiperefreshlayout,android-design-library

You can set onOffsetChanged listener for your AppBarLayout and prevent to swipe refreshing until AppBarLayout layout offset 0. This is good example : https://gist.github.com/blackcj/001a90c7775765ad5212...

Exception Dispatching Input Event and Null Pointer Exception on SwipeRefreshLayout Pull down

android,android-listview,nullpointerexception,android-support-library,swiperefreshlayout

Your OnRefreshListener is null, either you haven't set one or at some point of your code you are setting it to null. In the source of SwipeRefreshLayout, particularly in this snippet private void startRefresh() { removeCallbacks(mCancel); mReturnToStartPosition.run(); setRefreshing(true); mListener.onRefresh(); } on line 441, the mListener.onRefresh(); raises NullPointerException. ...

New version of SwipeRefreshLayout causes wrong draw of views

android,swiperefreshlayout

I was able to solve this issue by calling clearAnimation() on the onPause() method of my Fragment @Override public void onPause() { swipeLayout.clearAnimation(); super.onPause(); } ...

Android - asynctask that fills an adapter for a listview

android,android-listview,android-asynctask,android-adapter,swiperefreshlayout

I would set the list adapter up in the onCreate() method under your list view and make this a instance variable (not a local one) so that the Async task can access it as follows i.e. @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { lv = (ListView) rootView.findViewById(android.R.id.list);...

Android SwipeRefreshLayout with empty TextView not working properly

android,android-listview,swiperefreshlayout

I solved same problem by using FrameLayout, look at below code: <FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/layout_swipe_refresh" android:layout_width="match_parent" android:layout_height="wrap_content"> <ListView android:id="@+id/lv_products" android:layout_width="fill_parent" android:layout_height="wrap_content" android:divider="@null" /> </android.support.v4.widget.SwipeRefreshLayout>...

Subclassed SwipeRefreshLayout throws NullpointerException on refresh

java,android,swiperefreshlayout

that because you are not setting the onRefreshListener on the SwipeRefreshLayout. You have to change the following things. First, the layout: from <android.support.v4.widget.SwipeRefreshLayout to <your.pahat.to.newrefresh.NewRefresh the second thin, in your activity change from srl = new NewRefresh(findViewById(R.id.swipe_container).getContext()); srl.setView((ScrollView) findViewById(R.id.status_scroll_view)); to srl = (NewRefresh) findViewById(R.id.swipe_container); The rest looks good to me...

Listview getView method not getting called

android,listview,android-listview,baseadapter,swiperefreshlayout

In onCreateView(), it is not returning the root view, it is returning null because the class member v is null initially and is not modified. The existing code, change FROM: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { if (v == null) { View v = inflater... }...

Can't scroll in a ListView in a swipeRefreshLayout

android,swipe-gesture,swiperefreshlayout

I found an answer to my question. I am manually enabling the swipeRefreshLayout when the first child in the listview is at the top of the list. listView.setOnScrollListener(new AbsListView.OnScrollListener() { @Override public void onScrollStateChanged(AbsListView view, int scrollState) { } @Override public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount)...

IllegalArgumentException: pointerIndex out of range from SwipeRefreshLayout

android,android-support-library,swiperefreshlayout

I assume that exception is thrown while there is touch event still occurring (streamed down to the native touch while the Activity is about to onDestroy(). It is ok to mitigate this by catching the exception for the sake of avoiding crash. Activity is about to be destroyed if it...

How to pass int array of color resource ids from array.xml to SwipeRefreshLayout.setColorSchemeResources

android,pull-to-refresh,swiperefreshlayout

Turns out I was missing two key pieces. Wrong Code: swipeRefreshLayout.setColorSchemeResources(R.array.swipeRefreshColors); Correct Code: swipeRefreshLayout.setColorSchemeColors(getResources().getIntArray(R.array.swipeRefreshColors)); There were two things I was missing. 1) I needed to indicate that I was getting an IntArray from my array.xml file. This is done through getResources().getIntArray(R.array.swipeRefreshColors). The answer was deleted, but thanks to whoever suggested...

SwipeRefreshLayout - swipe down to refresh but not move the view pull down

android,android-layout,swiperefreshlayout

After my trial and error, I found one solution from http://www.dailydevbook.de/android-swiperefreshlayout-without-overscroll/ For people who can implement SwipeRefreshLayout, in order to achieve it STEP 1: DOWNLOAD android-support v4 (Open Source) from github android-support v4 - Download Link STEP 2: COPY following java class to your project src SwipeRefreshLayout SwipeProgressBar BakedBezierInterpolator note1-...

Scrolling down triggers refresh instead of revealing the toolbar

android,swiperefreshlayout,android-coordinatorlayout

Seems like you have to enable/disable the SwipeRefreshLayout when the AppBarLayout offset changes, using AppBarLayout.OnOffsetChangedListener. See http://stackoverflow.com/a/30822119/795820...

When switch fragment with SwipeRefreshLayout during refreshing, fragment freezes but actually still work

android,android-fragments,recyclerview,swiperefreshlayout

Well... After some struggling I eventually solved this problem by myself, in a tricky way... I just need to add these in onPause() : @Override public void onPause() { super.onPause(); ... if (mSwipeRefreshLayout!=null) { mSwipeRefreshLayout.setRefreshing(false); mSwipeRefreshLayout.destroyDrawingCache(); mSwipeRefreshLayout.clearAnimation(); } } ...

how to import android.support.v4.widget.SwipeRefreshLayout in my project

android,android-layout,android-support-library,swiperefreshlayout

=== Update === It seems support-v4 is not identical in your all projects. Just do one thing, make all support-v4 same (copy from one to other projects) === Update === There must be something wrong with library your dependency. Share more details so we can look into. This is Google...

Swipe up to load with LoaderManager/CursorAdapter, ContentProvider and Service

android,listview,android-listview,swiperefreshlayout

What you want is probably what is called an "infinite"/"lazy load" scrolling list. When user reaches the end of your list you should retrieve more items from the api. here is an example of how to implement it....

Disable click on RecyclerView inside a SwipeRefreshLayout

java,android,android-support-library,recyclerview,swiperefreshlayout

Use logic we had with ListAdapter. This will disable adapter items, instead their parent. public interface RecyclerViewItemEnabler{ public boolean isAllItemsEnabled(); public boolean getItemEnabled(int position); } And implementation should look like this: public class RecyclerAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> implements RecyclerViewItemEnabler{ @Override public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) { super.onViewAttachedToWindow(holder);...

SwipeRefreshLayout and AsyncHttpClient not working on first onCreate

android,listview,asynchttpclient,swiperefreshlayout

After further testing, I noticed it only happens on the emulator. When launching to a real device the app responds as expected. At this point I'm chalking it up to an emulator related issue, but will keep this thread updated if anything concrete develops....

SwipeToRefresh does not respect requestDisallowInterceptTouchEvent() in Android

android,reflection,swiperefreshlayout

You can temporary disable it. mPullToRefreshLayout.setEnabled(false); ...

SwipeRefreshLayout/ListFragment Loading style issues

android,android-styles,swiperefreshlayout

remove compile files('libs/android-support-v4.jar') and add compile 'com.android.support:appcompat-v7:+' compile 'com.android.support:support-v4:+' and you should get the rounded style...

Swiperefresh listview, updates but not how you would expect

android,listview,swiperefreshlayout

Looks like from my view of the code you have two adapters? mMainListAdapter and mAdapter? Since the data only appears when you scroll back, this means that you aren't properly notifying the adapter that you have updated the data. Call the notifyDatasetChanged() on the other adapter, since mMainListAdapter appears to...

SwipeRefreshLayout configuration

android,recyclerview,swiperefreshlayout

After the onRefresh() starts the icon won't stop spinning and will not disappear even when all the data is updated. Use SwipeRefreshLayout.setRefreshing(false) When I launch my app there is a white screen (while information is loading). If I try to make the refresh it will work but will load...

Android: CoordinatorLayout and SwipeRefreshLayout

android,appcompat,swiperefreshlayout,coordinator-layout

Set the scroll behavior to the SwipeRefreshLayout not the RecyclerView. <android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <android.support.v7.widget.RecyclerView android:id="@+id/cardList" android:layout_width="match_parent" android:layout_height="match_parent" android:scrollbars="vertical" />...

Android: CollapsingToolbarLayout and SwipeRefreshLayout

android,swiperefreshlayout,collapsingtoolbarlayout

Try adding an offset change listener to your AppBarLayout and enable or disable your swipe to refresh layout accordingly. Additional code available here: https://gist.github.com/blackcj/001a90c7775765ad5212 Relevant changes: public class MainActivity extends AppCompatActivity implements AppBarLayout.OnOffsetChangedListener { ... private AppBarLayout appBarLayout; private SwipeRefreshLayout mSwipeRefreshLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);...

SwipeRefreshLayout interfere with GridView inside ViewPager

android,gridview,android-viewpager,swiperefreshlayout

i hate answering my own question, but i always do:). so from an example of google SwipeRefreshMultipleViews, with a little change in class MultiSwipeRefreshLayout i managed to solve the problem....

Use color ints, as opposed to color resource ints, for SwipeRefreshLayout?

android,colors,android-resources,swiperefreshlayout

Not sure about the v19 support library, but the v20 one has the following methods: public void setColorSchemeResources(int colorRes1, int colorRes2, int colorRes3, int colorRes4) Which allows you to set the colors by resource. But the following method also exists, which takes colors: public void setColorSchemeColors(int color1, int color2, int...

Android - How to persist on same tab after refresh?

android,tabs,swiperefreshlayout

Use a SharedPreferences to store the last selected tab. selectedtab=tab.getSelectedTabIndex(); // or something else depending on your tab widget sharedpreference.edit().putInt("selectedtab",selectedtab).apply(); then on your onCreate on same class selectedtab=sharedpreference.getInt("selectedtab",0); tab.setSelectedTabIndex(selectedtab); ...

swiprefreshlayout keep refreshing inside onscroll method

android,android-layout,android-listview,synchronized,swiperefreshlayout

Since you are setting refreshing to false right away instead of in the post delayed bit, when the onScroll method is called it sees the swipeRefreshLayout.isRefreshing() as false all of the time. Therefore, the setRefresh is called over and over again. Moving the setRefreshing call to inside the Runnable should...