Calendar活动NullPointerException设置minDate和maxDate

时间:2015-06-17 11:02:03

标签: android nullpointerexception calendar maxdate mindate

当我在NullPointerException的{​​{1}}中设置minDatemaxDate时,我得到onCreate。 我迫不及待地寻找解决方案。

当我评论CalendarActivityminDate行时,没有任何问题。

我使用日期范围调用日历(通过http POST使用AsyncTask),当我更改此范围并增加它时,有时也没有问题。

我的Logcat:

maxDate

我将代码粘贴到06-17 12:32:39.636 21968-21968/com.example.lissar W/EGL_genymotion﹕ eglSurfaceAttrib not implemented 06-17 12:32:39.660 21968-21968/com.example.lissar W/EGL_genymotion﹕ eglSurfaceAttrib not implemented 06-17 12:32:39.664 21968-21968/com.example.lissar D/AndroidRuntime﹕ Shutting down VM 06-17 12:32:39.664 21968-21968/com.example.lissar W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xa4c00648) 06-17 12:32:39.676 21968-21968/com.example.lissar E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException at android.widget.CalendarView.onScroll(CalendarView.java:1214) at android.widget.CalendarView.access$900(CalendarView.java:76) at android.widget.CalendarView$2.onScroll(CalendarView.java:1075) at android.widget.AbsListView.invokeOnItemScrollListener(AbsListView.java:1340) at android.widget.ListView.layoutChildren(ListView.java:1762) at android.widget.AbsListView.onLayout(AbsListView.java:2012) at android.view.View.layout(View.java:14289) at android.view.ViewGroup.layout(ViewGroup.java:4562) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1525) at android.widget.LinearLayout.onLayout(LinearLayout.java:1434) at android.view.View.layout(View.java:14289) at android.view.ViewGroup.layout(ViewGroup.java:4562) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14289) at android.view.ViewGroup.layout(ViewGroup.java:4562) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1671) at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1660) at android.widget.LinearLayout.onLayout(LinearLayout.java:1436) at android.view.View.layout(View.java:14289) at android.view.ViewGroup.layout(ViewGroup.java:4562) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14289) at android.view.ViewGroup.layout(ViewGroup.java:4562) at com.android.internal.widget.ActionBarOverlayLayout.onLayout(ActionBarOverlayLayout.java:349) at android.view.View.layout(View.java:14289) at android.view.ViewGroup.layout(ViewGroup.java:4562) at android.widget.FrameLayout.onLayout(FrameLayout.java:448) at android.view.View.layout(View.java:14289) at android.view.ViewGroup.layout(ViewGroup.java:4562) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1976) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1730) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1004) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5481) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749) at android.view.Choreographer.doCallbacks(Choreographer.java:562) at android.view.Choreographer.doFrame(Choreographer.java:532) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735) at android.os.Handler.handleCallback(Handler.java:730) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) minDate方法所在的位置。maxDate的末尾:

onCreate

如何解决此错误?

1 个答案:

答案 0 :(得分:0)