剖析Android程序结构-----Android新手入门

  剖析Android程序(Anatomy of an Android Application)

  Android程序由4个板块构成(There are four building blocks to an Android application: )

  Acitvity用户界面管理器 (Acitvity) 
  消息收发器 (Intent Receiver)
  服务对象(Service)
  内容提供(Content Provider)

 不是每个程序都需要有着全部4个部分,但是你的程序将被包含这些部分(Not every application needs to have all four, but your application will be written with some combination of these.)

 你决定使用这些组件就需要在程序中例举出来在AndroidManifest.xml文件中,这是一个XML文件声明组件和其他能力请求(Once you have decided what components you need for your application, you should list them in a file called AndroidManifest.xml. This is an XML file where you declare the components of your application and what their capabilities and requirements are)

  Acitvity用户界面管理器 (Acitvity) 

   Activities大多数由4个Android板块构成,一个Activity通常由一个屏幕在你的程序中,每个Activity实现一个单独的类扩展Activity积累。你的类将显示用户界面包含Views和相应时间,大多数程序由多个屏幕构成。举个例子,一个文本消息程序可以由第一个屏幕显示一个列表连接着发送消息,第二个屏幕写入信息给选择的联系人,其他屏幕处理老的消息或改变设置。每个屏幕将由一个Avtivity实现。移动到其他屏幕显示一个新的Activity。在大多数情况下一个Activity可以返回上一个Activity的值,举个例子一个Activity能让用户选择一个照片将返回选择照片给调用者。(Activities are the most common of the four Android building blocks. An activity is usually a single screen in your application. Each activity is implemented as a single class that extends the Activity base class. Your class will display a user interface composed of Views and respond to events. Most applications consist of multiple screens. For example, a text messaging application might have one screen that shows a list of contacts to send messages to, a second screen to write the message to the chosen contact, and other screens to review old messages or change settings. Each of these screens would be implemented as an activity. Moving to another screen is accomplished by a starting a new activity. In some cases an activity may return a value to the previous activity -- for example an activity that lets the user pick a photo would return the chosen photo to the caller. )

 当一个新屏幕打开时,上一个屏幕将暂停并放入到历史栈中,用户可以浏览通过以前打开的屏幕在历史栈中,屏幕也可以选择被一处从历史栈当它不再保留时。Android保留每一个从主屏幕启动的程序到历史栈。(When a new screen opens, the previous screen is paused and put onto a history stack. The user can navigate backward through previously opened screens in the history. Screens can also choose to be removed from the history stack when it would be inappropriate for them to remain. Android retains history stacks for each application launched from the home screen. ) 

你可能感兴趣的:(剖析Android程序结构-----Android新手入门)