JessYanCoding / MVPArt

🎨 A new Android MVP architecture (此框架旨在解决传统 MVP 类和接口太多, 并且 Presenter 和 View 通过接口通信过于繁琐, 重用 Presenter 代价太大等问题).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

为什么我的 presenter 是空的

William-Chow opened this issue · comments

@OverRide
public void initData(@nullable Bundle savedInstanceState) {
mPresenter.requestGetToken(Message.obtain(MainActivity.this, new Object[]{true}));
}

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.art.client.android/com.art.client.android.mvp.ui.activity.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.art.client.android.mvp.presenter.MainPresenter.requestGetToken(me.jessyan.art.mvp.Message)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.art.client.android.mvp.presenter.MainPresenter.requestGetToken(me.jessyan.art.mvp.Message)' on a null object reference
at com.art.client.android.mvp.ui.activity.MainActivity.initData(MainActivity.java:27)
at me.jessyan.art.base.BaseActivity.onCreate(BaseActivity.java:84)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)

没事,我发现是我自己的问题