Forum Xamarin.Android

App crashes after a few seconds of plotting the chart

reeshaerumreeshaerum Member
edited June 2019 in Xamarin.Android

I am calling the timer every 100 milliseconds and running the UIThread in the timer function. I am getting the value of SpeedKmh from a server program by using another thread. The values are plotted on the chart but after sometime the app crashes. It this because the memory of the app is getting filled? How do I fix this problem?

Here is the code -

static FastLineSeries SpeedLine;
static ObservableCollection speedData = new ObservableCollection();

RunOnUiThread(() =>

            // Speed chart plotting
            Speed speed = new Speed() { Speed_xAxis = count, SpeedData = SpeedKmh };
            if (speed != null)
    SpeedLine = new FastLineSeries()
                ItemsSource = speedData,
                XBindingPath = "Speed_xAxis",
                YBindingPath = "SpeedData"
            SpeedLine.Color = Color.Yellow;



  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    Which is the exception?
  • reeshaerumreeshaerum Member
    edited June 2019

    There are no exceptions thrown. The app runs for a minute or so and then starts becoming slow and crashes.

  • AlessandroCaliaroAlessandroCaliaro ITMember ✭✭✭✭✭
    There is always an exception. Connect your device to a PC and debug the app. You should find some thing on Output Tab in Visual studio. Also Android Studio Logcat should visualize something
Sign In or Register to comment.