package lanbo.myweektest.model;
import java.util.List;
import retrofit2.Callback;
/**
* Created by asus on 2017/12/3.
*/
public interface IModel {
public void getFromnet(Callback callback);
public List getfromDB();
}
import java.util.List;
import retrofit2.Callback;
/**
* Created by asus on 2017/12/3.
*/
public interface IModel {
public void getFromnet(Callback callback);
public List getfromDB();
}
//实现类 m层
public class MyModel implements IModel {
@Override
public void getFromnet(Callback callback) {
Call<YunifangBean> call = MyApplication.server.get();
call.enqueue(callback);
}
// p层
写个p的方法
public void getfromnet(){
model.getFromnet(new Callback() { //这个Call 还是bean
@Override
public void onResponse(Call call, Response response) {
YunifangBean bean= (YunifangBean) response.body();
view.showview(bean);
}
@Override
public void onFailure(Call call, Throwable t) {
}
});
}