android - android文档错误 'Stopping and Restarting an Activity'

标签 android

上面提到的文档(http://developer.android.com/training/basics/activity-lifecycle/stopping.html)声明如下:

There are a few of key scenarios in which your activity is stopped and restarted:

The user opens the Recent Apps window and switches from your app to another app. The activity in your app that's currently in the foreground is stopped. If the user returns to your app from the Home screen launcher icon or the Recent Apps window, the activity restarts.

但在调试过程中,我发现当我启动“最近的应用程序”窗口时,我的 Activity 中被覆盖的 onStop() 被调用。因此,仅启动此窗口会使 Activity 停止,而不是用户需要切换到文档中当前所述的另一个应用程序。

这是 Android 文档错误吗?

最佳答案

不,这不是错误 - 该点中的最后一句话指出:

If the user returns to your app from the Home screen launcher icon or the Recent Apps window, the activity restarts.

(我的粗体)

声明(有点笨拙)如果用户从“最近使用的应用程序”窗口返回, Activity 将重新启动,暗示启动“最近使用的应用程序”窗口将停止 Activity 。

标题中有一点说明:

When the user leaves your activity, the system calls onStop() to stop the activity

因此,通过转到“最近的应用程序”窗口,您已离开该 Activity ,因此系统调用 onStop()

关于android - android文档错误 'Stopping and Restarting an Activity',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28658850/

相关文章:

java - 解码自定义类时出现 ClassNotFoundException

java - 我在 tdlib 中获取了 chatId,但我无法获取消息(tdAPI 或用于 java 的 Telegram 数据库库)

java - Bar.setBarStyle(BarStyle.RECTGRADIENT) 不按预期工作

android - 错误 : while Using Firebase and Google Map together in android Gradle File

ListActivity 中的 android-actionbar

android - 如何导出结构体成员

android - 在 android 中显示对话框时处理返回键

android - 如何录制 bt VideoView 播放的实时 rtsp (Vitamio)

java - Android DexClassLoader 错误, 'optimized data directory .. not owned by current user'

java - Android:如何通过Wifi执行Url请求