Acknowledged

Error Name: Data Field Is Not Running

eclipse/windows/SDK 4.1.4

Error Name: Data Field Is Not Running
Occurrences: 11
First Occurrence: 2022-07-17
Last Occurrence: 2022-07-18
Devices:
    fēnix® 5X / tactix® Charlie: 25.00
App Versions: 1.6.0
Languages: ind
Backtrace:
    PSX2View.onLayout:279

in line

class PSX2View extends UII.DataField 
{
    ...
    
    function onLayout(dc) 
    {
		var obscurityFlags = DataField.getObscurityFlags(); ///HERE ERROR
		...
	}
	
	...
}
		

  • code from wizard and run for all instead of fenix5 (and of course it's logical to have this value in onLayout() to avoid unnecessary counting)

    import Toybox.Activity;
    import Toybox.Graphics;
    import Toybox.Lang;
    import Toybox.WatchUi;
    
    class xxxView extends WatchUi.DataField {
    
        hidden var mValue as Numeric;
    
        function initialize() {
            DataField.initialize();
            mValue = 0.0f;
        }
    
        // Set your layout here. Anytime the size of obscurity of
        // the draw context is changed this will be called.
        function onLayout(dc as Dc) as Void {
            var obscurityFlags = DataField.getObscurityFlags();
    
            // Top left quadrant so we'll use the top left layout
            if (obscurityFlags == (OBSCURE_TOP | OBSCURE_LEFT)) {
                View.setLayout(Rez.Layouts.TopLeftLayout(dc));
    
            // Top right quadrant so we'll use the top right layout
            } else if (obscurityFlags == (OBSCURE_TOP | OBSCURE_RIGHT)) {
                View.setLayout(Rez.Layouts.TopRightLayout(dc));
    
            // Bottom left quadrant so we'll use the bottom left layout
            } else if (obscurityFlags == (OBSCURE_BOTTOM | OBSCURE_LEFT)) {
                View.setLayout(Rez.Layouts.BottomLeftLayout(dc));
    
            // Bottom right quadrant so we'll use the bottom right layout
            } else if (obscurityFlags == (OBSCURE_BOTTOM | OBSCURE_RIGHT)) {
                View.setLayout(Rez.Layouts.BottomRightLayout(dc));
    
            // Use the generic, centered layout
            } else {
                View.setLayout(Rez.Layouts.MainLayout(dc));
                var labelView = View.findDrawableById("label");
                labelView.locY = labelView.locY - 16;
                var valueView = View.findDrawableById("value");
                valueView.locY = valueView.locY + 7;
            }
    
            (View.findDrawableById("label") as Text).setText(Rez.Strings.label);
        }
    
        // The given info object contains all the current workout information.
        // Calculate a value and save it locally in this method.
        // Note that compute() and onUpdate() are asynchronous, and there is no
        // guarantee that compute() will be called before onUpdate().
        function compute(info as Activity.Info) as Void {
            // See Activity.Info in the documentation for available information.
            if(info has :currentHeartRate){
                if(info.currentHeartRate != null){
                    mValue = info.currentHeartRate as Number;
                } else {
                    mValue = 0.0f;
                }
            }
        }
    
        // Display the value you computed here. This will be called
        // once a second when the data field is visible.
        function onUpdate(dc as Dc) as Void {
            // Set the background color
            (View.findDrawableById("Background") as Text).setColor(getBackgroundColor());
    
            // Set the foreground color and value
            var value = View.findDrawableById("value") as Text;
            if (getBackgroundColor() == Graphics.COLOR_BLACK) {
                value.setColor(Graphics.COLOR_WHITE);
            } else {
                value.setColor(Graphics.COLOR_BLACK);
            }
            value.setText(mValue.format("%.2f"));
    
            // Call parent's onUpdate(dc) to redraw the layout
            View.onUpdate(dc);
        }
    
    }
    

  • "Use of this method is only valid during the call to onUpdate()."