我正在尝试创建一个白日梦应用程序,但似乎找不到任何关于在我的 DreamService 类中使用片段的文档。
我的意图是在 XML 文件中使用一个框架:
    <FrameLayout 
      android:id="@+id/content_frag"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_centerInParent="true"
      />
然后使用 FragmentManager 将我的片段添加到框架中:
    public void onAttachedToWindow( )
{
    setContentView(R.layout.daydream);
    getFragmentManager().beginTransaction().replace(R.id.content_frag, new ContentFragment(), "ContentFragment")
        .commit();
    super.onAttachedToWindow();
}
DreamService 中似乎没有“getFragmentManager()”或等效函数,因此这可能吗,我该怎么做?
谢谢