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);
} }

BaseActivity合集的更多相关文章

  1. 掘金 Android 文章精选合集

    掘金 Android 文章精选合集 掘金官方 关注 2017.07.10 16:42* 字数 175276 阅读 50053评论 13喜欢 669 用两张图告诉你,为什么你的 App 会卡顿? - A ...

  2. SQL Server技术内幕笔记合集

    SQL Server技术内幕笔记合集 发这一篇文章主要是方便大家找到我的笔记入口,方便大家o(∩_∩)o Microsoft SQL Server 6.5 技术内幕 笔记http://www.cnbl ...

  3. 【Android】开发中个人遇到和使用过的值得分享的资源合集

    Android-Classical-OpenSource Android开发中 个人遇到和使用过的值得分享的资源合集 Trinea的OpenProject 强烈推荐的Android 开源项目分类汇总, ...

  4. [Erlang 0122] Erlang Resources 2014年1月~6月资讯合集

    虽然忙,有些事还是要抽时间做; Erlang Resources 小站 2014年1月~6月资讯合集,方便检索.      小站地址: http://site.douban.com/204209/   ...

  5. [Erlang 0114] Erlang Resources 小站 2013年7月~12月资讯合集

    Erlang Resources 小站 2013年7月~12月资讯合集,方便检索.     附 2013上半年盘点: Erlang Resources 小站 2013年1月~6月资讯合集    小站地 ...

  6. SQL用法操作合集

    SQL用法操作合集   一.表的创建 1.创建表 格式: 1 CREATE TABLE 表名 2 (列名 数据类型(宽度)[DEFAULT 表达式][COLUMN CONSTRAINT], 3 ... ...

  7. Python学习路径及练手项目合集

    Python学习路径及练手项目合集 https://zhuanlan.zhihu.com/p/23561159

  8. Lucene搜索方式大合集

    package junit; import java.io.File; import java.io.IOException; import java.text.ParseException; imp ...

  9. [Erlang 0105] Erlang Resources 小站 2013年1月~6月资讯合集

    很多事情要做,一件一件来; Erlang Resources 小站 2013年1月~6月资讯合集,方便检索.      小站地址: http://site.douban.com/204209/     ...

随机推荐

  1. java的MethodHandle类详解

    一.总述   java7为间接调用方法提供了MethodHandle类,即方法句柄.可以将其看作是反射的另一种方式. 这是使用MethodHandle调用方法的一个例子: public class T ...

  2. 使用scp命令,远程上传下载文件/文件夹

    1.从服务器下载文件 scp username@servername:/path/filename /local/path例如: scp ubuntu@117.50.20.56:/ygf/data/d ...

  3. 通过js获取内网ip和外网ip的简单方法 ...

    今天遇到了一个需求,需要获取用户当前的内网ip, 找了半天终于找到了方法,遂将找到的方法记录下来,留给需要的人. 1,获取内网ip function getIP(callback) { let rec ...

  4. android studio2.3.3 模拟器 Jni函数调用C++对象,lldb调试this指针和相关变量显示无效的原因

    android studio2.3.3 的版本中 Jni函数调用C++对象,对象调用相关的成员函数, lldb调试,变量跟踪窗口,this指针和相关变量显示无效的原因,但这些参数实际是有效的,只是de ...

  5. 四大组件之Activity Task任务栈4种启动模式

    1.启动模式 standard,创建一个新的Activity. singleTop,栈顶不是该类型的Activity,创建一个新的Activity.否则,onNewIntent. singleTask ...

  6. HUE配置文件hue.ini 的pig模块详解(图文详解)(分HA集群和非HA集群)

    不多说,直接上干货! 一.默认的pig配置文件 ########################################################################### ...

  7. 解决securecrt连接centos使用VIM编辑中文时乱码

    vim ~/.vimrc 添加两行 set encoding=utf-8 set fileencodings=ucs-bom,utf-8,cp936

  8. python四种简单排序

    #!/usr/bin/python #排序方法 #冒泡排序 def buble(l): for i in range(len(l)): for j in range(len(l)-i-1): if l ...

  9. ASP.NET Core 中的依赖注入

    目录 什么是依赖注入 ASP .NET Core 中使用依赖注入 注册 使用 释放 替换为其它的 Ioc 容器 参考 什么是依赖注入 软件设计原则中有一个依赖倒置原则(DIP),为了更好的解耦,讲究要 ...

  10. R语言格式化数字和字符串format函数

    数字和字符串可以使用 format()函数的格式化为特定样式. 语法 format()函数的基本语法是: format(x, digits, nsmall,scientific,width,justi ...