Activity的生命周期(二)——简单继承父类
来源:互联网 发布:姬存希 知乎 编辑:程序博客网 时间:2024/06/02 02:13
父类代码:
/** * @author 贾涛 * @date 2016-2-27 上午5:59:49 */public class BaseActivity extends Activity {private String TAG = "BaseActivity";@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);Log.e(TAG, "onCreate");}@Overrideprotected void onStart() {super.onStart();Log.e(TAG, "onStart");}@Overrideprotected void onRestart() {super.onRestart();Log.e(TAG, "onRestart");}@Overrideprotected void onResume() {super.onResume();Log.e(TAG, "onResume");}@Overrideprotected void onPause() {super.onPause();Log.e(TAG, "onPause");}@Overrideprotected void onStop() {super.onStop();Log.e(TAG, "onStop");}@Overrideprotected void onDestroy() {super.onDestroy();Log.e(TAG, "onDestroy");}}
子类代码:
public class OneActivity extends BaseActivity {private String TAG = "OneActivity";@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);Log.e(TAG, "onCreate");}@Overrideprotected void onStart() {super.onStart();Log.e(TAG, "onStart");}@Overrideprotected void onRestart() {super.onRestart();Log.e(TAG, "onRestart");}@Overrideprotected void onResume() {super.onResume();Log.e(TAG, "onResume");}@Overrideprotected void onPause() {super.onPause();Log.e(TAG, "onPause");}@Overrideprotected void onStop() {super.onStop();Log.e(TAG, "onStop");}@Overrideprotected void onDestroy() {super.onDestroy();Log.e(TAG, "onDestroy");}}
activity_one.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.imooc.activitystudy.OneActivity" > <TextView android:id="@+id/tv_actName" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /></RelativeLayout>
【Activity创建】
【Activity休眠】
【Activity唤醒】
【Activity销毁】
【Activity旋转】
0 0
- Activity的生命周期(二)——简单继承父类
- Activity的生命周期(三)——结合Activity的生命周期理解子类继承父类预加载数据
- Activity的生命周期(二)
- Activity的生命周期(二)
- Activity生命周期(二)——多个Activity交互
- Activity的生命周期(二)
- Activity生命周期(二)
- Activity生命周期(二)
- Activity生命周期(二)
- Activity生命周期(二)
- 二、活动(Activity)的生命周期
- Activity的生命周期详解(二)
- Activity的生命周期详细分析(二)
- Android——简单说Activity的生命周期
- Android学习第8课—Activity生命周期(二)
- 简单类的继承(二)
- Activity的生命周期简单理解
- Activity生命周期的简单介绍
- 229. Majority Element II
- 如何解决Unsupported Architecture. Your executable contains unsupported architecture '[x86_64, i386]
- HDU 1026 Ignatius and the Princess I(BFS+优先队列)
- Activity的生命周期(一)
- C++ DirectX 游戏开发初级视频教程 20 资源下载链接
- Activity的生命周期(二)——简单继承父类
- DE26 Continuation: Repeated Real Eigenvalues
- Python图像处理库PIL的ImageEnhance模块介绍
- JAVA 一个简单的图形界面计算器
- 3910: 火车 LCA+并查集
- Activity的生命周期(三)——结合Activity的生命周期理解子类继承父类预加载数据
- Boost MPI send and recv
- 获取UIWebView的高度
- CS0234The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNet' (are you