FragmentTabHost添加Fragment后获取Fragment对象

在项目中遇到该问题,顺便记录一下:

FragmentTabHost mFragmentTabHost = findViewById(R.id.frag_tab_host);

String frgTag = mFragmentTabHost.getCurrentTabTag();

CustomFragmentDif cfd = (CustomFragmentDif )getSupportFragmentManager().findFragmentByTag(frgTag);

//CustomFragmentDif cfd = (CustomFragmentDif )getFragmentManager().findFragmentByTag(frgTag);

...

你可能感兴趣的:(android,FragmentTabHost)