I have an Android app with an AlarmManager that repeats every 15 minutes. Depending on the results from this I want to update the UI, but I don't want Android to bring the app to the foreground if it doesn't have focus already.
How can I do this? Alternatively, how can I make the UI updates run in onResume?
I'm calling methods like public static void updateRunningStatusTextView(Boolean inStatus)
on the main activity from services and classes
I'm pretty sure your first option can't happen. There is postInvalidate()
that can update the View
from a non UI
thread but this is available
...only when this View is attached to a window.
according to the Docs
Alternatively, how can I make the UI updates run in onResume?
This depends on many things such as the View
, the data, and what you have in your code but you could set the data in a static class or save it in something like SharedPreferences
then retrieve the data from there, say a String
to use in setText()
of a TextView