• Android MVP



    /**
    * presenter 层,承担业务逻辑处理,数据源处理等
    */
    public class MainPresenter extends BasePresenter<MainContract.IMainView> implements MainContract.IMainPresenter {

    private MainContract.IMainModel mModel;

    @Override
    public void attech(IBaseView view) {
    super.attech(view);
    mModel = new DataModel(http://www.amjmh.com/v/);
    }

    @Override
    public void handlerData() {
    getView().showDialog();

    mModel.requestBaidu(new Callback() {
    @Override
    public void onFailure(Call call, IOException e) {
    }

    @Override
    public void onResponse(Call call, Response response) throws IOException {
    String content = response.body().string();
    getView().succes(content);
    }
    });
    }

    @Override
    public void detech() {
    super.detech();
    /**
    * 释放内存、关闭网络请求、关闭线程等操作
    */
    Log.d("==========", "detech: 解除绑定,释放内存");
    }
    }
    --------------------- 

  • 相关阅读:
    2020/4/15
    2020/4/14
    2020/4/13
    2020/4/12
    2020/4/11
    2020/4/9
    PTA录入数据库题目流程
    PTA录题
    2020/4/8
    如何把mysql workbench的数据结构和数据导出到sql表中
  • 原文地址:https://www.cnblogs.com/hyhy904/p/11299086.html
Copyright © 2020-2023  润新知