Android学习记录:Acitivity

本文详细介绍了Android中Activity的生命周期状态,包括Resumed、Paused、Stopped等,并解释了这些状态之间的转换过程。此外还介绍了如何在AndroidManifest.xml文件中声明启动Activity。

新建一个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>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值