android - service sending string to another activity without opening it -


i have service working in background - service a. when open activity - activity a, want service change text displayed on edittext field of activity a. thought maybe if context of opened activity able use , work on views. possible?

also related question: if don't have name of field, can use loop run , search views in activity , properties?

it seems less direct method preferred getting this, rather have activity directly updated service. in fact, in general service/activity communications best handled in 1 of following ways:

  1. messagehandlers- basically, 1 can send message other, in turn other sets actions of text.
  2. broadcastreceivers (localbroadcastreceiver okay)- 1 part sends broadcast message listening, other sets listener message. intent passed, can contain message.

i suggest use second. application sends broadcast service upon opening, , service returns broadcast pass requested data activity.

see service docs android sdk.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -