《Hello, Android》的原文摘录

  • In Android, an application can be “alive” even if its process has been killed. Put another way, the activity life cycle is not tied to the process life cycle. Processes are just disposable containers for activities. This is probably different from every other system you’re familiar with, so let’s take a closer look before moving on. (查看原文)
    厚积薄发 2011-04-10 01:46:15
    —— 引自第36页
  • You, the developer, do not have control over what state your program is in. That’s all managed by the system. However, you do get notified when the state is about to change through the onXX() method calls. You override these methods in your Activity class, and Android will call them at the appropriate time. <图片1> (查看原文)
    厚积薄发 2011-04-10 01:46:15
    —— 引自第36页
  • A resource is a localized text string, bitmap, or other small piece of noncode information that your program needs. At build time all youe resources get complied into your application. You will create and store your resources in the res directory inside your project. The Android resource complier aapt processed resources according to which subfolder they are in and the format of the file.For example, PNG and JPG format bitmaps should go in a directorystarting with res/drawable, and XML files that describe screen layouts should go in a directory starting with res/layout. The resource complier compress and packs your resources and then generates a class named R that contains identifiers you use to reference those resources in your program. (查看原文)
    厚积薄发 2011-04-10 01:46:15
    —— 引自第36页
  • access to certain critical operations are restricted, and you must specifically ask for permission to use them in a file named Android-Manifest.xml. For example, to monitor incoming SMS messages, you would specify this in the manifest file: (查看原文)
    厚积薄发 2011-04-10 01:46:15
    —— 引自第36页
  • User interfaces can be designed using one of twp methods: procedural and declarative. Procedural simply means in code. Declarative desgin doesn't involve any code, such as HTML. Android tries to straddle the gap between the procedural and declarativeworlds by letting you create user interfaces in either style. You can stay almost entirely in Java code, or you can stay almost entirely in XML descriptors. If you look up the documentation for any Android user interface component, you’ll see both the Java APIs and the corresponding declarative XML attributes that do the same thing. Google's advice is to usedeclarative XML as much as possible. The XML code is often shorter and easier to understand than the corresponding Java code, and it's less likely to change in future versions. (查看原文)
    厚积薄发 2011-04-10 02:39:11
    —— 引自第44页