Dave Fussell
Dave Fussell

Reputation: 51

How to update textview of paused activity

I'm receiving intents in a broadcast receiver (declared in manifest), details of which I am 'logging' via b'cst intents received by my 'MainActivity', whose receiver updates the contents of a text view and is registered within the MainActivity code.

I'm wondering if there's a way to keep the contents of the MainActivity text view updated even if the MainActivity doesn't have 'focus' (i.e. another activity has been started). I appreciate that the b'cast receiver of the MainActivity will become unregistered upon pausing, but feel there ought to be a way to do this.

Any ideas?

Upvotes: 1

Views: 553

Answers (2)

Jovan
Jovan

Reputation: 1741

One of solutions is to use a handler inside receiver, and in that you call a static method inside your activity...inside that method you can update or whatever you need to do with your text view...

Upvotes: 0

meh
meh

Reputation: 22479

You should do all of that on the "onResume" of the activity, just when it gets to the foreground.

Upvotes: 1

Related Questions