java - Run a function synchronously in another thread -


how can run function synchronously in thread, meaning main ui thread has function calls function work on thread, waits new thread finish , returns value:

int mainfunction() //this function on main ui thread {    return doworkonnewthread(); }  int doworkonnewthread() {    //do work on new thread } 

you can use async task this, though it's asynchronous. can use callbacks onpostexecute , onprogressupdate update values needed. should note don't want synchronized block ui thread cause application not responding alert depending on how long calculation takes.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -