How to avoid Long Viewdraw()?

JassimRahmaJassimRahma USMember ✭✭✭✭

Hi,

I am trying simple user activation page where the user will enter his email and if found then he needs to enter his PIN but my Android is acting crazy with the the Long Viewdraw().

How can I fix this please?

and XAML and CS are attached:

Also attached my build log.

The problem happens on the async void btnActivate_Clicked event and it will just enter the while () then will never goes out

Thanks,
Jassim

Tagged:

Answers

  • batmacibatmaci DEMember ✭✭✭✭✭
    This usually occurs if you are doing long running task on ui thread and it is blocked till the task is finished. You should measure where you have long running task.
  • JassimRahmaJassimRahma USMember ✭✭✭✭

    but I am not doing any long process as you can see in the code.

    It's just few seconds to connect and check the PIN

  • JarvanJarvan Member, Xamarin Team Xamurai

    There seems to be no condition to terminate the while method, which will cause a while loop.

    if (reader.HasRows)
    {
        while (reader.Read())
        {
            Console.WriteLine("{0}\t{1}", reader.GetInt32(0),reader.GetString(1));
        }
    }
    else
    {
        Console.WriteLine("No rows found.");
    }
    
  • JassimRahmaJassimRahma USMember ✭✭✭✭

    @Jarvan said:
    There seems to be no condition to terminate the while method, which will cause a while loop.

    if (reader.HasRows)
    {
        while (reader.Read())
        {
            Console.WriteLine("{0}\t{1}", reader.GetInt32(0),reader.GetString(1));
        }
    }
    else
    {
        Console.WriteLine("No rows found.");
    }
    

    I tried that but still the same

  • batmacibatmaci DEMember ✭✭✭✭✭
    You better profile your code with xamarin profiler
  • JassimRahmaJassimRahma USMember ✭✭✭✭

    @batmaci said:
    You better profile your code with xamarin profiler

    It needs Visual Studio Enterprise but I am using Community Edition

  • JarvanJarvan Member, Xamarin Team Xamurai

    Hi, have you solved the problem? If so, please share you solution and it'll help others who face the simiar issue.

  • JassimRahmaJassimRahma USMember ✭✭✭✭

    Not Yet :(

  • batmacibatmaci DEMember ✭✭✭✭✭

    @JassimRahma said:

    @batmaci said:
    You better profile your code with xamarin profiler

    It needs Visual Studio Enterprise but I am using Community Edition

    you can install enterprise version for 30 days side by side with community. it is really helpful to see what is going on in your app. i would highly recommend it that you do it at least once.

Sign In or Register to comment.