Como hago para que una etiqueta conserve el color

hola soy nuevo aca y estoy haciendo una app para la vida útil de un articulo por minutos, cuando ingreso el valor en minutos; por ejemplo 4000 minutos se conserva verde y lo programe para que cuando baje a 200 o menos se ponga rojo. funciona si dejo la app abierta, sin embargo cuando la cierro y vuelvo a ingresar, no se me conserva el rojo, me muestra el verde así este sea un valor menos de 200.
-en este momento la etiqueta es blanca, cambia a verde y después a roja cuando cumple los valores.
-intente dejar la etiqueta verde y programar el rojo cuando baje de 200, cuando vuelvo a ingresar esta verde.
-lo intente con TyniDB, tampoco me funciono
si alguien puede orientarme haber que estoy haciendo mal, muchas gracias por la ayuda

1 Like

Hello, I’m new here and I’m making an app for the useful life of an item per minute, when I enter the value in minutes; for example 4000 minutes it stays green and I program it so that when it goes down to 200 or less it turns red. It works if I leave the app open, however when I close it and enter it again, the red does not remain, it shows me green even if this is a value less than 200.
-at this moment the label is white, it changes to green and then to red when it meets the values.
-Try to leave the green label and program the red when it goes below 200, when I enter this green again.
-I tried TyniDB, it didn’t work either
If someone can guide me, what am I doing wrong, thank you very much for the help

You would need to use Android Background Services for the App to run when closed. App Inventor does not support this. You could instead code your App in Android Studio using Java or Kotlin.

1 Like

You don’t need to run continuously to calculate the Duration time between two Instants.
Save the starting Instant in TinyDB.
Take the Duration between the TinyDB value of the starting Instant and Clock1.Now, and calculate your color based on that Duration.

Show us your blocks.

blocks
estos son los bloques que están ligados al botón guardar, cuando es mayor que 200 se pone verde y cuando es menor de ese valor se pone rojo, le cree hasta globales de color y no me dio, debe ser que no estoy sabiendo platear.
o si alguien lo resolvió por favor muestremen como lo hicieron

try the suggestion from @ABG

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

gracias por las ideas, era que estaba mal planteado, fue si no cambiar la distribución y funciono, lo dejare por aca para que nos retroalimentamos
blocks (2) .