【发布时间】:2013-12-02 23:43:59
【问题描述】:
我正在尝试从另一个 FragmentActivity(而不是 Fragment)加载 FragmentActivity,但出现错误。有没有办法做到这一点?
@SuppressLint("NewApi")
private void displayView(int position) {
if (getSupportFragmentManager().findFragmentByTag(Tab_Day.TAG) == null) {
getSupportFragmentManager().beginTransaction()
.replace(android.R.id.content, fragmentAct, Tab_Day.TAG).commit();
mDrawerList.setItemChecked(position, true);
mDrawerList.setSelection(position);
setTitle(navMenuTitles[position]);
mDrawerLayout.closeDrawer(mDrawerList);
}
}
这是我得到的错误:
The method replace(int, Fragment, String) in the type FragmentTransaction is not applicable for the arguments (int, FragmentActivity, String)
【问题讨论】:
标签: android android-fragments replace fragment android-fragmentactivity