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);
} }
BaseActivity合集的更多相关文章
- 掘金 Android 文章精选合集
掘金 Android 文章精选合集 掘金官方 关注 2017.07.10 16:42* 字数 175276 阅读 50053评论 13喜欢 669 用两张图告诉你,为什么你的 App 会卡顿? - A ...
- SQL Server技术内幕笔记合集
SQL Server技术内幕笔记合集 发这一篇文章主要是方便大家找到我的笔记入口,方便大家o(∩_∩)o Microsoft SQL Server 6.5 技术内幕 笔记http://www.cnbl ...
- 【Android】开发中个人遇到和使用过的值得分享的资源合集
Android-Classical-OpenSource Android开发中 个人遇到和使用过的值得分享的资源合集 Trinea的OpenProject 强烈推荐的Android 开源项目分类汇总, ...
- [Erlang 0122] Erlang Resources 2014年1月~6月资讯合集
虽然忙,有些事还是要抽时间做; Erlang Resources 小站 2014年1月~6月资讯合集,方便检索. 小站地址: http://site.douban.com/204209/ ...
- [Erlang 0114] Erlang Resources 小站 2013年7月~12月资讯合集
Erlang Resources 小站 2013年7月~12月资讯合集,方便检索. 附 2013上半年盘点: Erlang Resources 小站 2013年1月~6月资讯合集 小站地 ...
- SQL用法操作合集
SQL用法操作合集 一.表的创建 1.创建表 格式: 1 CREATE TABLE 表名 2 (列名 数据类型(宽度)[DEFAULT 表达式][COLUMN CONSTRAINT], 3 ... ...
- Python学习路径及练手项目合集
Python学习路径及练手项目合集 https://zhuanlan.zhihu.com/p/23561159
- Lucene搜索方式大合集
package junit; import java.io.File; import java.io.IOException; import java.text.ParseException; imp ...
- [Erlang 0105] Erlang Resources 小站 2013年1月~6月资讯合集
很多事情要做,一件一件来; Erlang Resources 小站 2013年1月~6月资讯合集,方便检索. 小站地址: http://site.douban.com/204209/ ...
随机推荐
- python实现计算器功能
import re def strip_operate(exp): # 合并多余的操作符 exp = exp.replace("+-", "-") exp = ...
- (转载)IDEA新建项目时,没有Spring Initializr选项
最近开始使用IDEA作为开发工具,然后也是打算开始学习使用spring boot. 看着博客来进行操作上手spring boot,很多都是说 创建一个新项目(Create New Project) 选 ...
- Git克隆与更新代码
一.克隆项目 除了可以向GitHub上提交项目外,更多的时候是我们到上面克隆(下载)优秀的开源项目来用,当然也可以将使用过程中发现的bug,通过建立分支的方式提交给项目的原作者. 现在的场景是在家将项 ...
- 关于chrome下的bug
最近看了大神的一篇文章,于是尝试了一下里面说的bug以及修复 1.Chrome下absolute绝对定位元素部分display属性值不渲染bug 首先还原一下bug.. ff下的下效果 点击按钮后的效 ...
- finally是否始终执行
The only times finally won't be called are: If you call System.exit() If the JVM crashes first If th ...
- JDK1.7新特性(3):java语言动态性之脚本语言API
简要描述:其实在jdk1.6中就引入了支持脚本语言的API.这使得java能够很轻松的调用其他脚本语言.具体API的使用参考下面的代码: package com.rampage.jdk7.chapte ...
- amazeui笔记-web组件
Json.parse()
- MYSQL DATE_FORMAT() 函数时间大小比较
DATE_FORMAT() 函数用于以不同的格式显示日期/时间数据. DATE_FORMAT(date,format) 可以使用的格式有: 格式 描述 %a 缩写星期名 %b 缩写月名 %c 月,数值 ...
- 折半插入排序-ACM题
第一种实现方式:(本人一开始对cin的使用不是很熟悉,看了一些人得博客详解后才有了第一种方式的实现,自己都被惊讶到了so easy:题目在下面) // // main.cpp // BinaryIns ...
- java核心技术-IO
一 .IO 1.1 流的简单介绍和分类 Java流操作的相关的类和接口: Java流类图结构: 四个抽象基类分别为:InputStream .OutputStream .Reader .Writer: ...