at the entrance to "data field" it breaks

Hello. I apologize twice because I am not a programmer and my English is 3/5. I jast run, and I need some data field for intervals, and I dont find it in store.

Having spent many hours i feel myself like Baby or Monkey face , but I compiled my application from many others. And it seems to me that I missed something.

It works on the simulator and even on my forerunner235, but it breaks when I enter the mode. Sometimes it works right away, but it's rare. I have to turn on the "run" mode (for example) and then through "Edit data fields" reelect/select my application. It's a little annoying Rage.

Сan anyone see and tell what is the matter? I think there is a very simple solution, because the calculation logic itself works, but as if something is missing at the input in the application

I download it https://github.com/DataForTraining/ForLapRun

Thanks!

  • Much of what you're doing in onUpdate() you probably want to do in compute() as that will run every second, even if the DF isn't currently displayed.

    Activity.Info is passed to compute so no need to get it yourself.

    But the main thing is you want to null check things you get from Activity.Info, as based on the state of the recording, values there can be null.

  • Thank you .

    1. Much of what you're doing in onUpdate() you probably want to do in compute()....... - this explains why it generated an error during activity, when switching between windows. It seemed to me that in the update() the data is considered faster and more correct, but this solution is not correct

    2. But ....... values there can be null. - that helped! is it necessary to write both options: if(info has :timerTime) and if(info.timerTime != null)?

    3. Is it posible to use "label" from Layouts for different values? I tried but it dont work, as i anderstand - "label" takes a lot of memory.

  • 2.  I rarely use "has" here - only for things that might not be available on all devices, but timerTime is always available.