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);
        }
    
    }
  • 相关阅读:
    HDU 1232 (畅通工程) 并查集经典模板题
    (POJ
    Gitlab利用Webhook实现Push代码后的jenkins自动构建
    Jenkins 配置git
    Jenkins安装及基本配置(Linux版,使用web容器 tomcat 搭建)
    Gitlab安装、汉化及使用
    ssh 免密码登录(设置后仍需输密码的原因及解决方法)
    appium1.4版本,每次运行appium时需要安装unlock,setting文件的解决方法
    jmeter完成md5加密的接口请求参数
    jmeter插件使用说明
  • 原文地址:https://www.cnblogs.com/zhujiabin/p/4201608.html
Copyright © 2011-2022 走看看