Fragment getArguments() 返回空

有一个Fragment其中有一个作为根布局的tabHost:

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />

        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">

            <FrameLayout
                android:id="@+id/tab_1"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent" />

            <!-- More FrameLayouts here - each are placeholders for Fragments -->    

        </FrameLayout>
    </LinearLayout>
</TabHost>

创建和更新Fragment的代码:

private void updateTab(String tabId, int placeholder) {
    FragmentManager fm = getFragmentManager();
    if (fm.findFragmentByTag(tabId) == null) {
        Bundle arguments = new Bundle();
        arguments.putInt("current_day", mCurrentTab);
        EpgEventListFragment fragment = new EpgEventListFragment();
        fragment.setArguments(arguments);

        fm.beginTransaction()
                .replace(placeholder, new EpgEventListFragment(), tabId)
                .commit();
    }
}

EpgEventListFragmentonCreate(...)方法中,我在获取参数Bunble的时候总是得到null:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle arguments = getArguments();
    if (arguments == null)
        Toast.makeText(getActivity(), "Arguments is NULL", Toast.LENGTH_LONG).show();
    else
        mCurrentDay = getArguments().getInt("current_day", 0);

    ...
}

不知道问题在哪?

我还试过在onAttach(...)中获取getArguments(),但是结果都一样,返回null。

请各位大侠帮忙解决一下哦。

fm.beginTransaction()
.replace(placeholder, new EpgEventListFragment(), tabId)
.commit();
这里有问题, 你又new了一个fragment 那么EpgEventListFragment fragment = new EpgEventListFragment();
fragment.setArguments(arguments); 这个fragment 完全没有用。
你修改成
fm.beginTransaction()
.replace(placeholder, fragment , tabId)
.commit();用该就OK了

看起来像是逻辑顺序的问题,你的 updateTab 是在哪里初始化的呢?

必须是空,你又没加入任何fragment

   fm.beginTransaction()
            .replace(placeholder, fragment, tabId)
            .commit();