android task与back stack 开发文档翻译 - 1

  次阅读 来源:互联网(转载协议) 2016-01-14 12:43 我要评论(0)

Task和Back Stack

An application usually contains multiple activities.

Each activity should be designed around a specific kind of action the user can perform and can start other activities.

For example, an email application might have one activity to show a list of new email.

When the user selects an email, a new activity opens to view that email.

一个应用通常包含多个activity

每个activity都应该被设计成围绕着一种用户可执行并且能打开其他activity明确的action

例如:一个邮件应用也许有一个activity用来显示新邮件列表

当用户选中一封邮件时,一个新activity被打开,用来查看这封邮件。

An activity can even start activities that exist in other applications on the device.

For example, if your application wants to send an email, you can define an intent to perform a "send" action and include some data, such as an email address and a message.

An activity from another application that declares itself to handle this kind of intent then opens.

In this case, the intent is to send an email, so an email application's "compose" activity starts (if multiple activities support the same intent, then the system lets the user select which one to use).

When the email is sent, your activity resumes and it seems as if the email activity was part of your application.

Even though the activities may be from different applications, Android maintains this seamless user experience by keeping both activities in the same task.

一个activity甚至可以打开设备中存在于其他应用的activity

例如:如果你的应用想发送一封邮件,你可以定义一个intent用来执行一个发送的action并且包含一些数据,比如邮件地址和信息

其他应用中,声明它自己可以处理这样的intent的activity会打开。

这个例子中,intent用来发送邮件,所以一个邮件程序的"compose" activity会启动(如果多个activity都支持这个intent,那么系统会让用户选择使用哪一个)

当邮件发送完毕,你的activity会resume并且邮件的activity看上去好像你的应用的一部分

虽然activity可能来自不同的应用,Android通过保持两个应用的activity在同一个task中来保持这种无缝的用户体验。

A task is a collection of activities that users interact with when performing a certain job.

The activities are arranged in a stack (the "back stack"), in the order in which each activity is opened.

一个task是用户执行一个任务时,与用户交互的activity的一个集合

这些activity按着被打开的顺序被整理到一个stack中(back stack)

The device Home screen is the starting place for most tasks.

When the user touches an icon in the application launcher (or a shortcut on the Home screen), that application's task comes to the foreground.

If no task exists for the application (the application has not been used recently), then a new task is created and the "main" activity for that application opens as the root activity in the stack.

设备的Home页面是大多数task的起始位置。

当用户触摸一个在launcher应用中的图标(或者Home页面中的快捷方式)时,应用的task就会来到前台。

如果这个应用还没有task(这个应用最近没有被使用过),那么一个新的task会被建立并且应用的“主”activity作为stack的根activity被打开。

When the current activity starts another, the new activity is pushed on the top of the stack and takes focus.

The previous activity remains in the stack, but is stopped.

本站部分文章来源于网络以及网友投稿,本站只负责对文章进行整理、排版、编辑,是出于传递更多信息之目的,并不意味着赞同其观点或证实其内容的真实性。如果您有什么意见或建议,请联系QQ28-1688-302!

人工智能实验室
相关文章相关文章
  • teamLab创始人猪子寿之: 抛去衣食住行,我还剩下什么?

    teamLab创始人猪子寿之: 抛去衣食住行,我还剩下什么?

  • Oculus公布原型机,大幅度提升可视角,能实现140°的视场水平

    Oculus公布原型机,大幅度提升可视角,能实现140°的视场水平

  • 2018深圳国际人工智能展览会 2018 shenzhen International Artif

    2018深圳国际人工智能展览会 2018 shenzhen International Artif

  • Michael I. Jordan带你解读百万奖金ATEC蚂蚁人工智能大赛

    Michael I. Jordan带你解读百万奖金ATEC蚂蚁人工智能大赛

网友点评网友点评
阅读推荐阅读推荐

据外媒报道,STEER打造了首款完全自动驾驶停车技术,旨在使常规车辆转变为无人驾驶车辆。STEER的首款技术应用是4级自动驾驶及网络安全停车...

近日,美国软性机器抓手制造商 Soft Robotics 宣布,获得 2000 万美元的融资,本轮投资者包括 Scale Venture Partners,Calibrate Ventures...

据外媒报道,加州车管局发布了《2017自动驾驶脱离报告(California Autonomous Vehicle Disengagement Reports)》,其中谈及了脱离的具体...

用人机语音交互,来解决智能家居适老的问题;通过家庭门禁与安防套件、空气净化套件、可燃气体与有害气体监控套件等相互联动,在不同生活情...