gpt4 book ai didi

java - Android 中的 SuperNotCalledException?

转载 作者:行者123 更新时间:2023-12-02 00:08:13 25 4
gpt4 key购买 nike

我的代码中遇到 SuperNotCalledException 问题。
我有一个包含 NavigationDrawerFragment 的 Activity,并且此 Exception 仅发生在“MOTOROLA”设备中。你可以看到raw(Log) here .
所以请帮助我克服这个问题。

这是我的代码:

@Override
protected void onCreate(Bundle savedInstanceState) {
try {
super.onCreate(savedInstanceState);
} catch (Exception e) {
e.printStackTrace();
}

Crashlytics.start(this);
setContentView(R.layout.activity_landing);

LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
DrawerLayout drawer = (DrawerLayout) inflater.inflate(R.layout.decor, null); // "null" is important.

ViewGroup decor = (ViewGroup) getWindow().getDecorView();
View child = decor.getChildAt(0);
decor.removeView(child);
sharedHelper = new SharedHelper(LandingActivity.this);

FrameLayout container = (FrameLayout) drawer.findViewById(R.id.container); // This is the container we defined just now.
FrameLayout containerChild = (FrameLayout) drawer.findViewById(R.id.containerChild); // This is the container we defined just now.
container.removeView(containerChild);
container.addView(child);
container.addView(containerChild);
child.setClickable(true);

decor.addView(drawer);
actionBarHeight = getResources().getDimensionPixelSize(R.dimen.abc_action_bar_default_height_material);
mNavigationDrawerFragment = (NavigationDrawerFragment)
getFragmentManager().findFragmentById(R.id.navigation_drawer);
mTitle = getTitle();

mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));

child.setClickable(true);
child.setFocusable(true);

FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.containerChild, new RecentChatFragment())
.commit();
}

最佳答案

您必须调用 super.onCreate() 作为第一条指令。

关于java - Android 中的 SuperNotCalledException?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32268763/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com