ui thread - Android UI: when can I directly modify a view? -


i have app 2 activities. main activity start secondary activity using startactivityforresult(). secondary activity returns data (in form of intent object) main activity. on main activity have method onactivityresult() handle come secondary activity.

within onactivityresult() method, need update view on main activity (to reflect new data values). not explicitly spawn threads. question is: can directly modify view within onactivityresult() method, or need put event on ui queue it? more explicit: can sure onactivityresult() method on ui thread, , in case can forget ui queue?

  1. yes, can modify view in onactivityresult(). can modify activity's views anytime after call setcontentview() in oncreate(), long running on ui thread.

  2. yes, onactivityresult() called on ui thread. true life cycle methods (oncreate(), onresume(), etc).


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -