locked
App crashes after a few seconds of plotting the chart RRS feed

  • Question

  • User386804 posted

    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(() => { count++;

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

    }

    Monday, June 24, 2019 6:19 AM

All replies

  • User2148 posted

    Which is the exception?

    Monday, June 24, 2019 6:33 AM
  • User386804 posted

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

    Monday, June 24, 2019 6:35 AM
  • User2148 posted

    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

    Monday, June 24, 2019 6:37 AM