java.lang.NullPointerException:尝试调用虚方法' void android.widget.ProgressBar.setVisibility(int)'在null对象引用上

时间:2016-09-14 21:52:38

标签: java android firebase-authentication

我正在编写一个Android应用程序,我不断收到此错误。

java.lang.RuntimeException: Unable to resume activity {com.blogspot.tipsberk.ultimatemap/com.blogspot.tipsberk.ultimatemap.SignupActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ProgressBar.setVisibility(int)' on a null object reference
                                                                                   at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3239)
                                                                                   at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3270)
                                                                                   at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2613)
                                                                                   at android.app.ActivityThread.access$800(ActivityThread.java:178)
                                                                                   at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1470)
                                                                                   at android.os.Handler.dispatchMessage(Handler.java:111)
                                                                                   at android.os.Looper.loop(Looper.java:194)
                                                                                   at android.app.ActivityThread.main(ActivityThread.java:5637)
                                                                                   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:959)
                                                                                   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)
                                                                                Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ProgressBar.setVisibility(int)' on a null object reference
                                                                                   at com.blogspot.tipsberk.ultimatemap.SignupActivity.onResume(SignupActivity.java:101)
                                                                                   at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1267)
                                                                                   at android.app.Activity.performResume(Activity.java:6178)

这就是第101行

98: @Override
  99:  protected void onResume() {
  100:    super.onResume();
  101:      progressBar.setVisibility(View.GONE);
  102:  }

请问我该怎么做?

0 个答案:

没有答案