Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个后台任务,偶尔会通过对话框提示用户,我希望它在应用程序的整个生命周期中运行。现在一切都由一个任务片段控制。所以我想知道是否可以从扩展的自定义应用程序类创建这个片段,Application如果可以,你怎么做?
Application
Fragmentandroid 中的类从android.app.Fragment. Application类从android.app.Application. 如果您想从您的应用程序中启动您的片段,只需fragmentManager在 Android 中使用即可。
Fragment
android.app.Fragment
android.app.Application
fragmentManager