public class NewsPresenter { private IView iView; public void attachView(IView iView){ this.iView=iView; } public void getNews(int num){ Map<String, String> map = new HashMap<>(); map.put("key", "48a7d7193e11bd2dd4a683b6e2f90a4f"); map.put("num", num+""); OkHttpUtil.getInstance().post("http://api.tianapi.com/meinv/", map, new CallBack() { @Override public void onSuccess(String tag, Object o) { AllBean bean = (AllBean) o; if (bean != null) { List<AllBean.NewslistBean> data = bean.getNewslist(); Log.d("TT", "onSuccess: "+data); Log.d("TT", "tag: "+tag); iView.success(tag, data); } } @Override public void onFailed(String tag, Exception e) { iView.failed(tag, e); } }, AllBean.class, "news"); } public void detachView() { if (iView != null) { iView = null; } } }
MVP p层
最新推荐文章于 2020-10-13 14:04:47 发布