我在真實設備上的DialogFragment出現了一些奇怪的問題。三星Galaxy Note 4.導致ANR的DialogFragment
當我嘗試打開一個對話框時,應用程序進入一個無限循環(來自系統的東西),並在一段時間後給ANR。一切都被阻止了。沒有日誌。在調試中,斷點位於對話框的show方法之後。
這裏是我用來顯示對話框的方法:
public void openLivecastMenuDialog() {
MenuDialog menuDialog = (MenuDialog) getSupportFragmentManager().findFragmentByTag(MENU_STORY_TAG);
if (null == menuDialog) {
// Menu fragment not found in the fragment manager, initialize it
menuDialog = MenuDialog.newInstance(MenuType.MENU_STORY, currentTag);
}
isCoverChanged = false;
// Show the menu fragment
menuDialog.show(getSupportFragmentManager(), MENU_STORY_TAG);
}
MenuDialog是一個 「v4.app.DialogFragment」。
什麼會產生這樣的行爲?
LE:
這不是因爲DialogFragment。這是因爲創建對話框時調用的Google Analytics。 該死的服務。
請發佈代碼片段 – 2015-04-03 15:06:52