点击时刷新数据
用处:在项目中,在错题集Fragment收藏了错题后,点到收藏Fragment以后,收藏Fragment刷新收藏题数据;
NetDataLayer 中的方法:
// 获取收藏题的数量接口
// http://10.0.0.194:96/api.php?action=getcount
// uid 用户ID
// scode 登录校验码
// clienttype 1:android手机客户端 3:IOS手机客户端
// 返回
// favor_count 收藏题的数量
public static String http_getcount() {
String write_data = "uid=" + UserHelper.userId
+"&scode=" +UserHelper.token
+"&clienttype=1";
return get_Http_Post("http://"+ApplicationApp.ipAdd + "/api.php?action=getcount", write_data);
}
然后在Activity_Main中写一个线程,当点击了收藏Fragment后,调用这个线程:
// 获取收藏题数量子线程
// 如果第一次count为空,将数据存入,每次进入时进行判断count和favor_count,如果相等不刷新,不相等刷新