//Model层
public class NewsModel {
public void getData(String url, ICallBack callBack, Type type){
HttpUtils.getInstance().get(url,callBack,type);
}
}
//View层
public interface IView {
void getCatgory(T t);
void failed(Exception e);
}
//P层
public class NPersent {
private IView iv;
private NewsModel mModel;
public void attach(IView iv){
this.iv = iv;
mModel = new NewsModel();
}
public void getCatgory(){
Type type = new TypeToken(){
}.getType();
String url = “http://www.xieast.com/api/news/news.php”;
mModel.getData(url, new ICallBack() {
@Override
public void onsucces(Object object) {
iv.getCatgory(object);
}
@Override
public void failed(Exception e) {
iv.failed(e);
}
},type);
}
}