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.
标题不言自明:我想知道新活动是否可以在 onCreate() 完成之前处理 onBackPressed()。换句话说,在生命周期的哪个时刻,软后退按钮触摸的处理转移到了新创建的活动?
提前致谢。
onBackPressed()在启动之前不会activity启动,即在onResume()完成之后。发生这种情况是因为activity需要从字面上看在前面,即在堆栈的顶部并且在屏幕上处于活动状态,以便发生后压。您将无法在生命周期onBackPressed()之前或之后启动。onCreate()activity's
onBackPressed()
activity
onResume()
onCreate()
activity's