android - DialogFragment 导致 ANR

标签 android dialog fragment android-anr-dialog

我在真实设备上使用 DialogFragment 时遇到一些奇怪的问题。三星 Galaxy Note 4。

当我尝试打开对话框时,应用程序进入无限循环(来自系统的某些内容),并在一段时间后给出 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。 这些服务该死。

最佳答案

这不是因为 DialogFragment。这是因为创建对话框时调用了 Google Analytics。这些服务该死。

关于android - DialogFragment 导致 ANR,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29434646/

相关文章:

android - 如何以编程方式更改底部导航 View 的图标?

java - 如何使用来自不同 Activity 的 SharedPreferences?

javascript - 确认对话框未显示

android - 将 AsyncTask onPreExecute 添加到 fragment

android - 为什么图像由android :src in xml remain stored in heap?设置

Android FragmentTransaction 不会向容器添加或替换 fragment

android - Proguard收缩导致空指针异常

android - V7.app.NotificationCompat 不适用于 Oreo

android - 显示对话框后如何关闭应用程序?

android - 如何在Android中添加自动评分栏