gpt4 book ai didi

android - 我收到错误 "cannot find symbol variable fragment"

转载 作者:行者123 更新时间:2023-11-30 01:13:23 25 4
gpt4 key购买 nike

我收到以下错误:

cannot find symbol variable fragment

如何解决这个错误?

public boolean onNavigationItemSelected(MenuItem item) {

int id = item.getItemId();

if (id == R.id.toi) {
fragment= new FragmentOne();
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.replace(R.id.content_frame, fragment);
ft.commit();

return true;
} else if ( id ==R.id.thehindu){

}else if (id == R.id.support) {

}

DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}

最佳答案

改变:

fragment= new FragmentOne();

收件人:

Fragment fragment= new FragmentOne();

关于android - 我收到错误 "cannot find symbol variable fragment",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38190406/

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