android - Making changes to Main Activity UI from thread in Service -


I'm looking for some good documents or a good example of this for some time from the worker thread in my service There is a change in your main activity UI which is going on in the background, as far as I think I think I'm supposed to work with some type of handler, but I'm not sure how to contact it Go.

Do anyone have any ideas or good examples that they can direct me to? The UI Elements I am changing is a TextView that informs the user about the status of the thread.

Thank you for your help

You just have a handler on the theater to make: Private Handler Service Handler = New Handler () {@ Override Public Wind Handmess (Message Message) {someFunctionInTheUIThread (); }};

and then pass it through your service. You can do a function in the service like this:

  public void registerHandler (handler service handler) {Handler = serviceHandler; }   

and then pass the handler in such a way:

  theservice = ((local billing service)) .getService (); TheService.registerHandler (serviceHandler);   

To send a message back then:

  Message msg = handler. Shareman (identifier, "message or data"); Handler.sendMessage (MSG);    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

c# - Confused over DLL entry points (entry point not found exception) -