在Dev Guide标签下,文档完整定义了Android(What is Android?),包括给出其特性、架构(底层硬件和上层软件)、自带应用、应用框架、库、运行环境以及其所带的Linux内核等信息和参数。在应用基础(Application Fundamentals)中介绍了四大应用组件——Activities,Services,Content providers以及Broadcast receivers。等等。本项目的开发过程,同样是对这些文档进行研读的过程;很多思想和实践指导着本应用于的开发,其中令人感受最深的是“edit in place”思想(实践)。
英文原文:(位于对Activity类进行规约的页面中。地址:http://developer.android.com/reference/ ... ivity.html )
For content provider data, we suggest that activities use a "edit in place" user model. That is, any edits a user makes are effectively made immediately without requiring an additional confirmation step. Supporting this model is generally a simple matter of following two rules:
- When creating a new document, the backing database entry or file for it is created immediately. For example, if the user chooses to write a new e-mail, a new entry for that e-mail is created as soon as they start entering data, so that if they go to any other activity after that point this e-mail will now appear in the list of drafts.
- When an activity's onPause() method is called, it should commit to the backing content provider or file any changes the user has made. This ensures that those changes will be seen by any other activity that is about to run. You will probably want to commit your data even more aggressively at key times during your activity's lifecycle: for example before starting a new activity, before finishing your own activity, when the user switches between input fields, etc.
中文译文:
对于内容提供者型数据(前文有定义),我们建议活动体采用一种“即编即达”(或“写直达”)的用户模型。该模型是指,对用户所作出的任何编辑,不必提供额外的确认环节,一律使之生效(有点太绝对,有些情形下应该要先由用户确认——译者注)。要支持该模型,通常只需遵循以下两条原则即可:
- 一个新的文档当在概念上创建的时候,在物理上(后台数据库记录或文件)就应该被立即创建了。比如,如果用户选择了写邮件,那么在用户开始输入数据的那一刻,该邮件的一个永久存储就被创建了;这之后,如果用户跳到了其他活动体(即使退出邮件程序——译者增),该邮件都会以草稿的形式被保存。
- 当活动体的onPause()方法被调用时,应该将用户所作的任何更改立即写回后台数据库或文件。这确保了这些更改能够被其他即将运行的活动体获知。或许你还可能需要更加频繁地写回这些的更改,比如在你活动体生命周期中的关键时刻:在启动一个新的活动体之前,在结束你的活动体之前,在用户切换输入域之时,等等。