zoukankan      html  css  js  c++  java
  • BaseActivity合集

    1.出自“高仿京东商城”:

    package com.itau.jingdong.ui.base;
    
    import com.itau.jingdong.AppManager;
    import com.itau.jingdong.config.Constants;
    import com.itau.jingdong.image.ImageLoaderConfig;
    import com.nostra13.universalimageloader.core.ImageLoader;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.os.Handler;
    
    /**
     * @author Tau.Chen 陈涛
     * 
     * @email tauchen1990@gmail.com,1076559197@qq.com
     * 
     * @date 2013年9月12日
     * 
     * @version V_1.0.0
     * 
     * @description
     * 
     */
    public abstract class BaseActivity extends Activity {
    
        public static final String TAG = BaseActivity.class.getSimpleName();
    
        protected Handler mHandler = null;
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            // TODO Auto-generated method stub
            super.onCreate(savedInstanceState);
            AppManager.getInstance().addActivity(this);
            if (!ImageLoader.getInstance().isInited()) {
                ImageLoaderConfig.initImageLoader(this, Constants.BASE_IMAGE_CACHE);
            }
        }
    
        @Override
        protected void onDestroy() {
            // TODO Auto-generated method stub
            super.onDestroy();
        }
    
        @Override
        protected void onPause() {
            // TODO Auto-generated method stub
            super.onPause();
        }
    
        @Override
        protected void onRestart() {
            // TODO Auto-generated method stub
            super.onRestart();
        }
    
        @Override
        protected void onResume() {
            // TODO Auto-generated method stub
            super.onResume();
        }
    
        @Override
        protected void onStart() {
            // TODO Auto-generated method stub
            super.onStart();
        }
    
        @Override
        protected void onStop() {
            // TODO Auto-generated method stub
            super.onStop();
        }
    
        /**
         * 绑定控件id
         */
        protected abstract void findViewById();
    
        /**
         * 初始化控件
         */
        protected abstract void initView();
    
        /**
         * 通过类名启动Activity
         * 
         * @param pClass
         */
        protected void openActivity(Class<?> pClass) {
            openActivity(pClass, null);
        }
    
        /**
         * 通过类名启动Activity,并且含有Bundle数据
         * 
         * @param pClass
         * @param pBundle
         */
        protected void openActivity(Class<?> pClass, Bundle pBundle) {
            Intent intent = new Intent(this, pClass);
            if (pBundle != null) {
                intent.putExtras(pBundle);
            }
            startActivity(intent);
        }
    
        /**
         * 通过Action启动Activity
         * 
         * @param pAction
         */
        protected void openActivity(String pAction) {
            openActivity(pAction, null);
        }
    
        /**
         * 通过Action启动Activity,并且含有Bundle数据
         * 
         * @param pAction
         * @param pBundle
         */
        protected void openActivity(String pAction, Bundle pBundle) {
            Intent intent = new Intent(pAction);
            if (pBundle != null) {
                intent.putExtras(pBundle);
            }
            startActivity(intent);
        }
    
    }
  • 相关阅读:
    字符串加密和解密的常类
    vs2013中使用nuget下载cefsharp winform包
    序列积第m小元素 二分答案优化
    贪心 park
    struct结构体 重载运算符
    最小生成树kruskal 知识点讲解+模板
    c++快读与快输模板
    MZOJ #82 总统竞选
    MZOJ #83 位运算
    MZOJ #81 最小得分和
  • 原文地址:https://www.cnblogs.com/zhujiabin/p/4201608.html
Copyright © 2011-2022 走看看