使用xUtils快速开发框架需要有以下权限: <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
删除表:
db.dropTable(ItemBean.class);
db.configAllowTransaction(true);
条件删除:
dbutils.delete(Driay.class, WhereBuilder.b("id", "=", d.getId()));
findAll = dbutils.findAll(Selector.from(Driay.class))
查询单列
models = dbutils.findDbModelAll(Selector.from(Driay.class).select("objectId"));
分页查询
findAll = dbutils.findAll(Selector.from(Driay.class).limit(5));//查询driay类
多条件查询
msg = db.findFirst(Selector.from(Chat.class).where("diaryid","=",iterator.next()).and("year", "!=", 20));
保存
dbutils.save(保存的是对象)
HttpUtils使用
HttpUtils http = new HttpUtils(); http.send(HttpRequest.HttpMethod.GET, "http://www.baidu.com", new RequestCallBack<String>(){ @Override public void onLoading(long total, long current, boolean isUploading) { testTextView.setText(current + "/" + total); } @Override//成功 public void onSuccess(ResponseInfo<String> responseInfo) { textView.setText(responseInfo.result); } @Override public void onStart() { } @Override//失败 public void onFailure(HttpException error, String msg) { } });
BitmapUtils bitmapUtils = new BitmapUtils(this); // 加载网络图片 bitmapUtils.display(testImageView, "http://bbs.lidroid.com/static/image/common/logo.png"); // 加载本地图片(路径以/开头, 绝对路径) bitmapUtils.display(testImageView, "/sdcard/test.jpg"); // 加载assets中的图片(路径以assets开头) bitmapUtils.display(testImageView, "assets/img/wallpaper.jpg"); // 使用ListView等容器展示图片时可通过PauseOnScrollListener控制滑动和快速滑动过程中时候暂停加载图片 listView.setOnScrollListener(new PauseOnScrollListener(bitmapUtils, false, true)); listView.setOnScrollListener(new PauseOnScrollListener(bitmapUtils, false, true, customListener));