使用 Android快速开发框架 Afinal 0.3 快速开发网络应用相关APK
http://blog.csdn.net/michael_yy/article/details/8227648
afinal 0.3 主要更新如下:
1、更新FinalBitmap模块,解决线程并发没有回收线程的问题,并解决了若干bug
2、重写了FinalHttp模块(参考了国内外多个优秀开源框架,取其精华)
3、FinalDb添加了数据库升级监听器
4、修复0.2 若干bug
代码已经上传到:
http://code.google.com/p/afinal/
https://github.com/yangfuhai/afinal
若你有什么好的建议和意见,可以oschina中@我 或者给我邮件:mail#yangfuhai.com
具体 change log 如下:
FinalBitmap添加三个方法
public void onResume()
public void onPause()
public void onDestroy()
在activity生命周期方法中调用给方法释放内存和暂停图片加载线程
FinalHttp添加方法如下(注意,目前AjaxCallBack泛型只支持String和file。有时间将会扩展JSONObject,xmlDom,byte[],bitmap等):
public HttpClient getHttpClient()
public HttpContext getHttpContext()
public void configCookieStore(CookieStore cookieStore) //配置cookie
public void configUserAgent(String userAgent)
public void configTimeout(int timeout)//配置超时时间
public void configSSLSocketFactory(SSLSocketFactory sslSocketFactory) //配置https请求
public void configRequestExecutionRetryCount(int count)//配置网络异常自动重复连接请求次数
public void addHeader(String header, String value) //添加http请求头
//------------------get 请求-----------------------
public void get( String url, AjaxCallBack<? extends Object> callBack)
public void get( String url, AjaxParams params, AjaxCallBack<? extends Object> callBack)
public void get( String url, Header[] headers, AjaxParams params, AjaxCallBack<? extends Object> callBack)
public Object getSync( String url) //同步get请求,请在子线程执行这个操作,否则非常有可能报ANR
public Object getSync( String url, AjaxParams params)
public Object getSync( String url, Header[] headers, AjaxParams params)
//------------------post 请求-----------------------
public void post(String url, AjaxCallBack<? extends Object> callBack)
public void post(String url, AjaxParams params, AjaxCallBack<? extends Object> callBack)
public void post( String url, HttpEntity entity, String contentType, AjaxCallBack<? extends Object> callBack)
public void post( String url, Header[] headers, AjaxParams params, String contentType,AjaxCallBack<? extends Object> callBack)
public void post( String url, Header[] headers, HttpEntity entity, String contentType,AjaxCallBack<? extends Object> callBack)
public Object postSync(String url) //同步post请求,请在子线程执行这个操作,否则非常有可能报ANR
public Object postSync(String url, AjaxParams params)
public Object postSync( String url, HttpEntity entity, String contentType)
public Object postSync( String url, Header[] headers, AjaxParams params, String contentType)
public Object postSync( String url, Header[] headers, HttpEntity entity, String contentType)
//------------------put 请求-----------------------
public void put(String url, AjaxCallBack<? extends Object> callBack)
public void put( String url, AjaxParams params, AjaxCallBack<? extends Object> callBack)
public void put( String url, HttpEntity entity, String contentType, AjaxCallBack<? extends Object> callBack)
public void put(String url,Header[] headers, HttpEntity entity, String contentType, AjaxCallBack<? extends Object> callBack)
public Object putSync(String url) //同步put请求,请在子线程执行这个操作,否则非常有可能报ANR
public Object putSync( String url, AjaxParams params)
public Object putSync(String url, HttpEntity entity, String contentType)
public Object putSync(String url,Header[] headers, HttpEntity entity, String contentType)
//------------------delete 请求-----------------------
public void delete( String url, AjaxCallBack<? extends Object> callBack)
public void delete( String url, Header[] headers, AjaxCallBack<? extends Object> callBack)
public Object deleteSync(String url) //同步delete请求,请在子线程执行这个操作,否则非常有可能报ANR
public Object deleteSync( String url, Header[] headers)
//---------------------文件下载---------------------------------------
public void download(String url,String target,AjaxCallBack<File> callback)
public void download( String url,AjaxParams params, String target, AjaxCallBack<? extends Object> callback)