登陆界面 , 输入框挡住了 登陆按钮
1. 列表排序
2. 数据(图片,文字)缓存(内存缓存,文件缓存)
3. 动态监听网络变化.如果没有网络,就不能从服务器上获取东西了
6. 版本检测升级
You can use:
compile 'com.nineoldandroids:library:2.4.0+'
or if you have the library copied to your project libs directory, you can use:
compile files ('libs/ nineoldandroids-2.4.0.jar')
发现/data的文件权限是drwxrwx--x这是linux的文件权限
第一个代表文件类型d是directory目录
后面三个是创建者的权限r读w写x执行
再后面三个是同组者的权限
最后三个是其他人的权限
我们从DDMS查看的时候就是其他人的权限发现只有执行 因此只需修改权限就可以了
编写一个QQ 聊天机器人
adb shell su -c "chomd 777 /data"
adb shell su -c "chomd 777 /data/data"
{"role":"admin","
username":"admin","
user_id":1,
"userinfo":{"birthday":null,"sex":null,"phone":"",
"date_create":"2015-12-05T16:47:48.738774"
,"hometown":"","truename":"","nickname":"","jobposition":"","department":"","lastlogin_ip":"","student_id":"","dormitory":"","college":"","idcard":"","lastlogin_date":"2015-12-06T21:52:57.382838","photo":"","lastlogin_ua":"","is_lunar_birthday":false,"email":"","qq":"","major":""},
"date_modify":"2015-12-05T16:47:48.739725"}
.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
Log.e("TAG", String.valueOf(jsonObject));
PersonInfo personInfo = gson.fromJson(String.valueOf(jsonObject), PersonInfo.class);
Log.e("TAG", "Username:" + personInfo.getUsername());
Log.e("TAG", "Sex:" + personInfo.getUserinfo().getSex());
Log.e("TAG", "Auto: " + personInfo.getAuthorization());
MainActivity 里面的的 StringRequest . 没事就用它...
StringRequest jsObjRequest = new StringRequest(URL, new Response.Listener<String>() { @Override public void onResponse(String s) { Log.e("TAG", s); List<Person> list = new ArrayList<>(); Log.e("TAG", "标志1"); try { PersonInfo person = gson.fromJson(s, PersonInfo.class); } catch (Exception e) { Log.e("TAG", e.toString()); } Log.e("TAG", "标志2"); // Log.e("TAG", person.getUsername()); // list.add(person); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError volleyError) { Log.e("TAG", "这里打印的是错误: " + volleyError); } }) { @Override public Map<String, String> getHeaders() throws AuthFailureError { final String authorization = getIntent().getStringExtra("Authorization"); Map<String, String> headers = new HashMap<String, String>(); headers.put("Authorization", authorization); return headers; } };
研究 TokenYje
for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = null; try { jsonObject = (JSONObject) jsonArray.get(i); //数组里面的第几个 String user_id = jsonObject.getString("user_id"); Log.e("TAG", "user_id" + user_id); } catch (JSONException e) { e.printStackTrace(); } } Person person = gson.fromJson(jsonArray.toString(), Person.class); //解析Json 字符串 List<Person> persons = gson.fromJson(jsonArray.toString(), new TypeToken<List<Person>>() { //解析Json 数组 }.getType());
HttpUtils httpUtils = new HttpUtils(); RequestParams requestParams = new RequestParams(); requestParams.addHeader("Authorization", authorization); httpUtils.send(com.lidroid.xutils.http.client.HttpRequest.HttpMethod.GET, URL, requestParams, new RequestCallBack<String>() { @Override public void onStart() { Log.e("TAG", "正在连接..."); } //网速 @Override public void onLoading(long total, long current, boolean isUploading) { Log.e("TAG", "正在下载()..."); /* download_pb.setProgress((int) ((double) current/ (double) total * 100)); tv.setText((int) (current * 100 / total) + "%");*/ Log.e("TAG", ((int) (current * 100 / total) + "%") + ""); } @Override public void onSuccess(ResponseInfo<String> responseInfo) { Log.e("TAG", String.valueOf(responseInfo.result)); } @Override public void onFailure(com.lidroid.xutils.exception.HttpException error, String msg) { Log.e("TAG", String.valueOf(error)); Log.e("TAG", msg); } });
HttpUtils http = new HttpUtils(); RequestParams requestParams = new RequestParams(); requestParams.addHeader("Authorization", authorization); handler = http.download(URL, sdPath,requestParams, true, //如果目标文件存在,接着未完成的部分继续下载。是否断点下载 . 服务器不支持RANGE时将从新下载。 false, // 如果从请求返回信息中获取到文件名,下载完成后自动重命名。 new RequestCallBack<File>() { @SuppressWarnings("deprecation") @Override public void onStart() { Log.e("TAG", "正在连接"); } @Override public void onLoading(long total, long current, boolean isUploading) { super.onLoading(total, current, isUploading); Log.e("TAG", "正在下载"); Log.e("TAG", String.valueOf((int) (current * 100 / total)+"%")); /* download_pb.setProgress((int) ((double) current / (double) total * 100)); tv.setText((int) (current * 100 / total) + "%");*/ } @Override public void onSuccess(ResponseInfo<File> responseInfo) { // tv.setText(responseInfo.result.getPath()); Log.e("TAG", "下载成功"); Log.e("TAG", responseInfo.result.toString()); } @Override public void onFailure(com.lidroid.xutils.exception.HttpException error, String msg) { Log.e("TAG", msg); } });
HttpUtils http = new HttpUtils(); RequestParams requestParams = new RequestParams(); requestParams.addHeader("Authorization", authorization); handler = http.download(URL, sdPath,requestParams, true, //如果目标文件存在,接着未完成的部分继续下载。是否断点下载 . 服务器不支持RANGE时将从新下载。 false, // 如果从请求返回信息中获取到文件名,下载完成后自动重命名。 new RequestCallBack<File>() { @SuppressWarnings("deprecation") @Override public void onStart() { // tv.setText("正在连接"); Log.e("TAG", "正在连接"); } @Override public void onLoading(long total, long current, boolean isUploading) { super.onLoading(total, current, isUploading); Log.e("TAG", "正在下载"); Log.e("TAG", "(int) (current * 100 / total) + \"%\")"); Log.e("TAG", "正在下载"); /* btn_down.setText("正在下载"); download_pb.setProgress((int) ((double) current / (double) total * 100)); tv.setText((int) (current * 100 / total) + "%");*/ } @Override public void onSuccess(ResponseInfo<File> responseInfo) { // tv.setText(responseInfo.result.getPath()); Log.e("TAG", "下载成功"); Log.e("TAG", responseInfo.result.toString()); Log.e("TAG", responseInfo.result.getPath()); } @Override public void onFailure(com.lidroid.xutils.exception.HttpException error, String msg) { // tv.setText(msg); Log.e("TAG", msg); // btn_down.setText("暂停<span style="font-family: Arial, Helvetica, sans-serif;">"); } });