multithreading - Android: runOnUiThread() Runnable Sequencing -


i have 2 jni native methods callback java methods in ui.

1) display progress.. 2) dismiss progress

both of above calls in sequence. both call java methods create new runnables follows:

m_activity.runonuithread( new runnable() {   @override   public void run()   {     displayprogressupdate( m_progresspercent );   } } ); 

--

m_activity.runonuithread( new runnable() {   @override   public void run()   {     m_progress.dismiss();   } } ); 

what seeing dismiss runnable happening before progress update runnable completes. have thought because called in sequence , because both being requested on same (ui) thread occur in sequence well. not case?

is why should using such handler synchronise/sequence these calls?

edit: ok, implemented handler , still observed same behaviour. debug confused me. looked though dismiss java code happening before progress update had completed, in fact java debug printing jni called java method did posting handler - not actual runnable thread itself. so.. tajonn07 right in way - dialog box closing before had chance see , debug lead me astray. helping guys.

runonuithread not added on queue in android , called when invoke. if want queue / sequence(ie 1 after another), have use handler.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -