新建一个Acitivity
http://web.mit.edu/hychenj/MacData/afs/sipb/project/android/docs/training/basics/firstapp/starting-activity.html
http://blog.sina.com.cn/s/blog_8191005601019nzn.html
只有三种状态是静态的,并且Activity只能处于其中的一个状态。
-
Resumed
- In this state, the activity is in the foreground and the user can interact with it. (Also sometimes referred to as the "running" state.) Paused
- In this state, the activity is partially obscured by another activity—the other activity that's in the foreground is semi-transparent or doesn't cover the entire screen. The paused activity does not receive user input and cannot execute any code. Stopped
- In this state, the activity is completely hidden and not visible to the user; it is considered to be in the background. While stopped, the activity instance and all its state information such as member variables is retained, but it cannot execute any code.
The other states (Created and Started) are transient and the system quickly moves from them to the next state by calling the next lifecycle callback method. That is, after the system calls onCreate()
, it quickly callsonStart()
, which is quickly followed by onResume()
.
The main activity for your app must be declared in the manifest with an <intent-filter>
that includes theMAIN
action and LAUNCHER
category. For example:
<activity android:name=".MainActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>