android app调试工具,BeeFramework_Android

#BeeFramework 0.1

##BeeFramework是什么

BeeFramework Android版主要为Android初级开发人员提供一个基于MVC开发模式的APP DEMO,并提供一套APP内调试工具,包括

查看网络数据请求历史

Crash Log列表

真机WIFI环境下模拟2G\3G网络

查看APP性能(内存占用,CPU占用等)

##快速开始

###什么是MVC

MVC是一种软件架构模式,把系统分为模型(Model),视图(View)和控制器(Controller).

MVC通过简化软件的复杂度,是程序更加直观,易于复用,扩张和维护。

在Android的App开发中,通常控制器是Activity,控制界面跳转,处理请求,刷新界面。

View对应Android系统的各种layout,实现界面绘制。

Model则用来发起HTTP请求,存储本地数据。

###开启调试模式

需要Application继承自BeeFrameworkApp,在MainActivity按返回键时,调用

BeeFrameworkApp.getInstance().showBug(this);

80c6aada3b1e9759f8f2ef2c94bf2325.png

###网络数据请求

网络库使用Android Query,并做进一步封装。

(1) 创建一个datamodel类。

public class ShotModel extends BaseModel

{

public ShotModel(Context context)

{

super(context);

}

}

(2)在Activity中新建model。

shotModel = new ShotModel(this);

shotModel.addResponseListener(this);

(3)在datamodel中创建网络请求方法

public void getData()

{

String url = ApiInterface.SHOT_LIST;

BeeCallback cb = new BeeCallback(){

@Override

public void callback(String url, JSONObject jo, AjaxStatus status)

{

ShotModel.this.OnMessageResponse(url, jo, status);

}

};

cb.url(url).type(JSONObject.class).method(Constants.METHOD_GET);

aq.ajax(cb);

}

(4)在Activity中实现BusinessResponse方法,网络请求成功后,会调用该方法,在此处理界面刷新等操作

public void OnMessageResponse(String url, JSONObject jo, AjaxStatus status)

throws JSONException

{

}

###关于数据存储

任何一个实现继承自Model的对象都可以实现存储。

例如:

public class COMMENT extends Model

{

}

存储: COMMENT comment = new COMMENT();

comment.save()

读取:

COMMENT comment = new Select().from(COMMENT.class).where("COMMENT_id = ?", 1).orderBy("COMMENT_id ASC").executeSingle();

###开启Crash Log

String path = Environment.getExternalStorageDirectory().getAbsolutePath() + AppConst.LOG_DIR_PATH;

File storePath = new File(path);

storePath.mkdirs();

Thread.setDefaultUncaughtExceptionHandler(new CustomExceptionHandler(

path, null));

###模拟2G/3G网络

BeeQuery.setForceThrottleBandwidth(true);

BeeQuery.setMaxBandwidthPerSecond(1000);//限定1000Bytes/s

##作者

Howiezhang

HouXin

切磋请移步QQ群:330271021

a0f609b288c7de88131b6f6ba37c81b3.png

Copyright and license

______ ______ ______

/\ __ \ /\ ___\ /\ ___\

\ \ __< \ \ __\_ \ \ __\_

\ \_____\ \ \_____\ \ \_____\

\/_____/ \/_____/ \/_____/

Copyright (c) 2013-2014, {Bee} open source community

http://www.bee-framework.com

Permission is hereby granted, free of charge, to any person obtaining a

copy of this software and associated documentation files (the "Software"),

to deal in the Software without restriction, including without limitation

the rights to use, copy, modify, merge, publish, distribute, sublicense,

and/or sell copies of the Software, and to permit persons to whom the

Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in

all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE

AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS

IN THE SOFTWARE.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值