-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cancel the network request in ondestroy() of the activity, should you consider it #26
Comments
Hi, @Vector-SMG I cannot understand what do you mean, because I do not make any network request in Activity. All the network requests are sending in Fragment. But like you point out, cancelling the request when the activity or fragment is going to destroy is necessary. If you find anything wrong about that, show me more details so I can fix it. |
@TonnyL 在Activity或者fragment的onDestroy()的生命周期中,有可能当前界面中,还存在网络请求在执行,导致内存溢出或者空指针异常等等。所以取消网络请求是必要的,当前主流做法:1.如果网络请求中,用到rxjava,使用RxLifecycle来全局取消 2.使用ViewModel+LiveData来管理。是否考虑将其加入?完善这部分逻辑? |
@Vector-SMG 你说的很对, 会考虑你的建议. |
No description provided.
The text was updated successfully, but these errors were encountered: