Remove all pending messages when fragment destroyed
Remove all pending messages when the fragment has destroyed. Otherwise, after fragment disattachs its context, an exception will be reported when process the messages. Bug:377166756 Change-Id: I333cedb45c0fe43b81abbfbe19e37f42f98def91 Signed-off-by: dingfeisong <dingfeisong@xiaomi.corp-partner.google.com>
This commit is contained in:
@@ -207,7 +207,9 @@ public class AddAppNetworksFragment extends InstrumentedFragment implements
|
|||||||
@Override
|
@Override
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
mWorkerThread.quit();
|
mWorkerThread.quit();
|
||||||
|
if (mHandler.hasMessagesOrCallbacks()) {
|
||||||
|
mHandler.removeCallbacksAndMessages(null);
|
||||||
|
}
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user