java - Should findviewbyid be called in UI thread? -
the question is: should call activity.findviewbyid
in ui thread only?
the reason i'm asking call arbitrary thread , works flawlessly. got exception 1 of users: findviewbyid
fails npe
somewhere in findviewtraversal
.
so, can cause?
the android ui toolkit not thread-safe , must manipulated on ui thread.
taken painless threading.
because it's not thread-safe, don't know happen if use api in thread. might work, might not work, might work of time, might never work or might work , breaks other things. can't tell.
thus, if want correct application, must in ui thread.
Comments
Post a Comment