ListView IsRefreshing UI being blocked by a Task

aga913aga913 Member ✭✭
edited January 16 in Xamarin.Android

Hi,
i'm using a Listview to display a list of items in my android app
My listview have Pull To Refresh property enabled
when i pull down the screen the PullToRefresh UI shows as expected after about a second it stops spinning and become in responsive
after following this bug around i had it clear that this is starting when the app reaches a Task...
i'm not sure if i'm not firing the Task correctly or this is how the Pull To Refresh is supposed to behave ?
here is a snippet from the code that i'm using...

    private string Sends(string link)
    {
        Task<HttpResponseMessage> responseTask = client.GetAsync(link);
        string result = string.Empty;
        Task continuation = responseTask.ContinueWith(x =>
        {
            return result = Prints(x);
        });
        continuation.Wait();
        return result;
    }

    private string Prints(Task<HttpResponseMessage> httpTask)
    {
        Task<string> task = httpTask.Result.Content.ReadAsStringAsync();
        string result = string.Empty;
        Task continuation = task.ContinueWith(t =>
        {
            result = t.Result;
        });
        continuation.Wait();
        return result;
    }

Answers

  • jezhjezh Member, Xamarin Team Xamurai

    If it is conveniet for you , could you please post a basic demo or some more code snippet so that we can help you better?

Sign In or Register to comment.