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 [email protected],[email protected]
 *
 * @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);
    }

}
时间: 2024-08-24 03:34:23

BaseActivity合集的相关文章

Vim命令合集

来源:Vim命令合集 命令历史 以:和/开头的命令都有历史纪录,可以首先键入:或/然后按上下箭头来选择某个历史命令. 启动vim 在命令行窗口中输入以下命令即可 vim 直接启动vim vim filename 打开vim并创建名为filename的文件 文件命令 打开单个文件 vim file 同时打开多个文件 vim file1 file2 file3 ... 在vim窗口中打开一个新文件 :open file 在新窗口中打开文件 :split file 切换到下一个文件 :bn 切换到上一

[转载]VIM命令合集

Vim命令合集 http://www.cnblogs.com/softwaretesting/archive/2011/07/12/2104435.html 命令历史 以:和/开头的命令都有历史纪录,可以首先键入:或/然后按上下箭头来选择某个历史命令. 启动vim 在命令行窗口中输入以下命令即可 vim 直接启动vim vim filename 打开vim并创建名为filename的文件 文件命令 打开单个文件 vim file 同时打开多个文件 vim file1 file2 file3 ..

前端资源教程合集

综合类 前端知识体系 前端知识结构 Web前端开发大系概览 Web前端开发大系概览-中文版 Web Front-end Stack v2.2 En类资源汇总 免费的编程中文书籍索引 前端书籍 前端免费书籍大全 前端知识体系 免费的编程中文书籍索引 智能社 - 精通JavaScript开发 重新介绍 JavaScript(JS 教程) 麻省理工学院公开课:计算机科学及编程导论 JavaScript中的this陷阱的最全收集--没有之一 JS函数式编程指南 JavaScript Promise迷你书

减肥视频合集

薄荷味视频合集 http://www.boohee.com/posts/view/222199/1?sub_id=3 我最爱练习Insanity http://www.bilibili.com/video/av3596373/

转载:2013计算机视觉代码合集

转载,原文地址http://blog.csdn.net/daoqinglin/article/details/23607079 -------------------------------------------------------------------------- 来源: http://www.yuanyong.org/cv/cv-code-one.html http://www.yuanyong.org/cv/cv-code-two.html http://www.yuanyong

图像滤镜艺术---微软自拍APP滤镜实现合集DEMO

微软最近退出了自家的美颜app,大家有兴趣可以在苹果商店中下载一下看一看,今天,我们要说的便是这款app中的所有滤镜实现问题. 这款app中一共有14款滤镜效果,分别是:自然.增强.1965.X-PRO.布兰登.沧桑.复古.凉爽.迈耶.清晨.柔嫩.深沉.水墨.糖果: 这14款滤镜中,"自然"这一款滤镜是结合人脸识别的,在有人脸识别的情况下,会弹出调节bar,没有人脸时,改效果为默认效果,无法调节:"增强"属于细节的增强与锐化,这里也不算入特效滤镜中去,对于剩下的12

02对话框合集

对话框合集 一.确定对话框AlertDialog() 1.AlertDialog的创建,Builder创建,类似工厂模式2.Builder.show()底层 public AlertDialog show() { AlertDialog dialog = create(); dialog.show(); return dialog; }3.核心代码: public void click1(View view) { Builder builder = new Builder(this);//类似工

最牛叉的街机游戏合集 &amp; 模拟器

亲爱的小伙伴们,是否还记得那年我们玩的疯狂的街机游戏吗,街机中心提供400多个街机游戏,让你爽到底. 例如:拳皇96,拳皇97,恐龙新世纪.名将.快打旋风.惩罚者.魂斗罗.超级玛丽.雪山兄弟.忍者神龟.格斗之王系列.合金弹头系列.侍魂系列.龙虎之拳系列.街头霸王系列.西游释厄传系列和三国战纪系列等经典街机游戏. 性能高的手机可以打开显示设置内的平滑拉伸,缩放模式设置为拉伸至全屏,横屏需要开启系统的自动旋转屏幕.Xperia Play用户可以自定义物理按键,然后把触摸控制可见关闭,屏幕上就不会再显

JS_DOM_鼠标、键盘事件合集

JS_DOM_鼠标.键盘事件合集 鼠标事件 onclick         鼠标点击事件 ondblclick          鼠标双击事件 onmousedown 鼠标按下事件 onmouseup       鼠标按键被松开事件 onmouseenter        鼠标指针移上时出发事件(不支持冒泡) onmouseleave        鼠标指针移出事件 onmousemove 鼠标移动事件 onmouseover     鼠标移入事件(移入子元素也会触发) onmouseout