android - Reference to a background thread Handler in the UI thread -


this question has answer here:

i know when create new background thread can give new thread reference ui thread's handler can send updates main thread(provided constructor in thread class has handler parameter). example in ui go this:

handler mainhandler;  backgroundthread mynewthread = new backgroundthread(mainhandler); mynewthread.start(); 

here's question:

how can give ui thread reference handler create on background thread, can move data ui thread background thread???

handlers thread safe. can use them convey messages between threads, works cross process (e.g. communication between remote service , ui).

there 1 trick tough, doing right. here example how right: link


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -