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.
在我的活动类中,我调用启动服务并且服务工作正常。在服务中,基于一些测试,我想将活动置于前台(启动服务的活动)。在服务类中写什么来获得前台活动。我需要它前台,因为如果用户打开另一个应用程序,那么我的活动将进入后台。提前致谢
您应该在开始活动时使用它 intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);