0

In my Android app I want to have a couple of demonstration functions (i.e., functions that are not yet implemented but I want to show what they would look like if they were).

All that needs to be done is to change the text and background color of TextView elements, at specified times.

For example, when the app starts up, I have a TextView that says

"classroom level: good" (with a green background)

Throughout the day - this app will be monitored all day by somebody - I would like to change the TextView to say

"classroom level: crowded" (with a yellow background)

or

"classroom level: full" (with a red background)

or, back to

"classroom level: good" (with a green background)

I would like to do this on a set scheduled script, say, at 0900 switch to X, then at 1015 switch to Y, then at 1210 switch back to X, then at 1330 switch to Z. If I can't get this working, I might need to use a Math.random() to generate a pause in-between changes.

There are other functional components on the app that users will be interacting with, as well as them switching to other apps, then back to my app. Like I said, the app will be running all day, and people will be using it while it is running.

So, should I use a Service or Thread in order to do this.

  • Will this feature require access to remote data in a database? – Robert Harvey May 12 '16 at 15:04
  • Nope ... just random data; either good, crowded, or full. And the corresponding color. – Brian May 12 '16 at 15:07
  • By service, do you mean a service on the phone? Will it service multiple applications? – Robert Harvey May 12 '16 at 15:24
  • This kind of Service click me – Brian May 12 '16 at 15:33
  • I would only do that if you think there might be a chance that you want to perform this function for more than one application. – Robert Harvey May 12 '16 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.