0

When I launch my activity i refresh my list with

swipeContainer.setRefreshing(true);

after refreshing is call

swipeContainer.setRefreshing(false);

But during the networkcalls The refreshIcon glitches, in a fraction of a second

and If I look to the Android Monitor I get these lines

D/OpenGLRenderer: endAllStagingAnimators on 0x7f926f5800 (RippleDrawable) with handle 0x7f8dcf50e0

D/OpenGLRenderer: endAllStagingAnimators on 0x7f7ce78000 (ListView) with handle 0x7f89455380

What does this mean? and how can I fix this that I don't get the glitches and messages?

it is realy annoying

EDIT 1 This is how I call my setRefreshing(true)

    swipeContainer.post(new Runnable() {
        @Override
        public void run() {
            swipeContainer.setRefreshing(true);
        }
    });
vanlooverenkoen
  • 2,121
  • 26
  • 50

1 Answers1

0

I use a swipeRefreshLayout, this might be usefull for you:

My XML code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/background2"
android:layout_marginTop="56dp"
android:weightSum="1">

<android.support.v4.widget.SwipeRefreshLayout
    android:id="@+id/swipelayout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ListView
        android:id="@+id/lv1"
        android:layout_marginTop="15dp"
        android:layout_width="wrap_content"
        android:layout_height="0dp"
        android:background="#f0f0f0"
        android:alpha="0.90"
        android:layout_weight="1.01" />

</android.support.v4.widget.SwipeRefreshLayout>

This is the code I use to refresh the activity:

SwipeRefreshLayout mSwipeRefreshLayout;

mSwipeRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.swipelayout);

    mSwipeRefreshLayout.setOnRefreshListener(
            new SwipeRefreshLayout.OnRefreshListener() {
                @Override
                public void onRefresh() {
                    finish();
                    startActivity(getIntent());
                }
            }
    );
Robbert
  • 68
  • 2
  • 12
  • This is exactly what I have done as well, but the first time you open your activity the list needs to be called from my server, and if you use just Your code the progressbar only appears when you pull down, I tought by caling setRefreshing(true) the progressbar will be showen, and if the task is done (in the other thread) I call setRefreshing(false) – vanlooverenkoen Apr 08 '16 at 10:08
  • @KoenVanLooveren So what you are saying you want it to refresh upon loading data from your server? i am doing technically everything the same, i pull data from an WebAPI and then fill the listview with the data, if i understand your response correctly, what you are saying is you want to refresh the listview upon creating it? why? if you populate the listview correctly and have it setup correctly it should already be filled before you see anthing. If i didnt understand fully then sorry :) – Robbert Apr 08 '16 at 10:12
  • No that is not true, I open my activity and only then will the data be called from the internet, because I only need that data on that activity – vanlooverenkoen Apr 08 '16 at 10:16
  • @KoenVanLooveren So you create your view first and then populate the list? sorry I dont fully understand your situation. – Robbert Apr 08 '16 at 10:18
  • yes so my view is created then I get my list of my server, (over network) and while You are waiting for the list (over network) I want to show the user the same loading bar as if he pulled down to refresh the list – vanlooverenkoen Apr 08 '16 at 10:19
  • @KoenVanLooveren is there any specific reason why you want to do it like this? Instead of that you can also load the data first and then show the user, then you can use this code for example to refresh the list for any changes. – Robbert Apr 08 '16 at 10:22
  • yes, but when you are loading the data first! the listview is empty so the user doesn't see anything, loading can take up to 3 seconds with bad internet. So during this loading-proces I want to show a progresbar (the same one as if the user pulled down) – vanlooverenkoen Apr 08 '16 at 10:26
  • @KoenVanLooveren Then im sorry but i cant help you. I only started with android 2 months ago so i dont have alot of knowledge about this subject. Goodluck and have a nice day :) – Robbert Apr 08 '16 at 10:28