I have an Thread running and i set a listener to know when the job is done, in my listener i have a method onCompleted
which returns me some data i use to update my UI
elements. Some times i get NPEs, i think because the user changes Activity
or something similar.
I tried using NULL
checks but it is pretty annoying to do every time.
Now i want to ask if somebody knows an easy way to avoid this instead of place null checks into my code?
看一看AsyncTask类,该类专门设计用于Activity和UI线程。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.