我正在使用AndroidHive寄存器登录,它在这个登录寄存器的示例项目中工作正常.
但经过多次尝试使用CardViews和其他小部件尝试后,此错误出现在LogCat:
java.lang.NullPointerException: Attempt to invoke virtual method 'void client.myproject.app.AppController.addToRequestQueue(com.android.volley.Request, java.lang.String)' on a null object reference
at client.myproject.RegisterActivity.registerUser(RegisterActivity.java:185)
at client.myproject.RegisterActivity.access$300(RegisterActivity.java:35)
at client.myproject.RegisterActivity$1.onClick(RegisterActivity.java:81)
at android.view.View.performClick(View.java:4780)
at android.view.View$PerformClick.run(View.java:19866)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5254)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
Run Code Online (Sandbox Code Playgroud)
虽然这些代码在单个应用程序中正常工作(只需注册登录).
我正在使用Volley库.