prolificinteractive / material-calendarview

A Material design back port of Android's CalendarView
https://prolificinteractive.github.io/material-calendarview/
MIT License
5.92k stars 1.31k forks source link

NoSuchMethodException when adding calendar to fragment #180

Closed samnab closed 8 years ago

samnab commented 9 years ago

New to programming so IDK if I'm missing something obvious but I get a NoSuchMethodeException when I put the calendar into the fragment layout and when I inflate the Fragment. Any help would be greatly appreciated.

FATAL EXCEPTION: main android.view.InflateException: Binary XML file line #1: Error inflating class com.prolificinteractive.materialcalendarview.MonthView

Caused by: java.lang.NoSuchMethodException: [class android.content.Context, interface android.util.AttributeSet] at java.lang.Class.getConstructorOrMethod(Class.java:423)

(stack from Design View of activity xml) java.lang.NoSuchMethodException: com.prolificinteractive.materialcalendarview.MonthView.(android.content.Context, android.util.AttributeSet) at java.lang.Class.getConstructor0(Class.java:2892) at java.lang.Class.getConstructor(Class.java:1723) at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:389) at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:170) at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:103) at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:190) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:218) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:145) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:835) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:811) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70) at android.view.LayoutInflater.rInflate(LayoutInflater.java:811) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:394) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:223) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:426) at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350) at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:510) at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:498) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:888) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:498) at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:72) at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:610) at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:607) at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:366) at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:607) at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:629) at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:480) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320) at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310) at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254) at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269) at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227) at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217) at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238) at com.intellij.util.Alarm$Request$1.run(Alarm.java:351) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745)

Jogan commented 8 years ago

post your fragment code. I'll reopen if you are still having trouble.

SaurabhAdmane commented 6 years ago

Getting same issue, please tell me solution

com.prolificinteractive.materialcalendarview.CalendarPagerView -> o.sI: at o.sB.instantiateItem(Unknown Source:138) at o.ᓯ.addNewItem(Unknown Source:1034) at o.ᓯ.populate(Unknown Source:1182) at o.ᓯ.populate(Unknown Source:1116) at o.ᓯ.onMeasure(Unknown Source:1642) at android.view.View.measure(View.java:16834) at o.sM.onMeasure(Unknown Source:1650) at android.view.View.measure(View.java:16834) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:824) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:500) at android.view.View.measure(View.java:16834) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1621) at android.widget.LinearLayout.measureVertical(LinearLayout.java:742) at android.widget.LinearLayout.onMeasure(LinearLayout.java:607) at android.view.View.measure(View.java:16834) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374) at android.widget.FrameLayout.onMeasure(FrameLayout.java:340) at android.view.View.measure(View.java:16834) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374) at android.widget.FrameLayout.onMeasure(FrameLayout.java:340) at android.view.View.measure(View.java:16834) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5374) at android.widget.FrameLayout.onMeasure(FrameLayout.java:340) at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2332) at android.view.View.measure(View.java:16834) at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2252) at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1315) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1513) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1192) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6231) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:788) at android.view.Choreographer.doCallbacks(Choreographer.java:591) at android.view.Choreographer.doFrame(Choreographer.java:560) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:774) at android.os.Handler.handleCallback(Handler.java:808) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5292) at java.lang.reflect.Method.invokeNative(Method.java) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640) at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:132) at dalvik.system.NativeStart.main(NativeStart.java)

com.prolificinteractive.materialcalendarview.CalendarPagerView -> o.sI: java.util.Calendar tempWorkingCalendar -> ˎ java.util.ArrayList weekDayViews -> ˋ java.util.ArrayList decoratorResults -> ॱ int showOtherDates -> ˊ com.prolificinteractive.materialcalendarview.MaterialCalendarView mcv -> ʽ com.prolificinteractive.materialcalendarview.CalendarDay firstViewDay -> ˏ com.prolificinteractive.materialcalendarview.CalendarDay minDate -> ˊॱ com.prolificinteractive.materialcalendarview.CalendarDay maxDate -> ʼ int firstDayOfWeek -> ʻ java.util.ArrayList dayViews$5036ee31 -> ᐝ 30:55:void (com.prolificinteractive.materialcalendarview.MaterialCalendarView,com.prolificinteractive.materialcalendarview.CalendarDay,int) -> 58:64:void buildWeekDays(java.util.Calendar) -> ॱ 12081:12081:int com.prolificinteractive.materialcalendarview.CalendarUtils.getDayOfWeek(java.util.Calendar):81:81 -> ॱ 12081:12081:void buildWeekDays(java.util.Calendar):59 -> ॱ 67:74:void addDayView(java.util.Collection,java.util.Calendar) -> ॱ 77:88:java.util.Calendar resetAndGetWorkingCalendar() -> ˏ 12327:12327:com.prolificinteractive.materialcalendarview.CalendarDay getFirstViewDay():327:327 -> ˏ 12327:12327:java.util.Calendar resetAndGetWorkingCalendar():77 -> ˏ 14193:14195:void com.prolificinteractive.materialcalendarview.CalendarDay.copyTo(java.util.Calendar):193:195 -> ˏ 14193:14195:java.util.Calendar resetAndGetWorkingCalendar():77 -> ˏ 14193:14195:java.util.Calendar resetAndGetWorkingCalendar():77 -> ˏ 16092:16092:int getFirstDayOfWeek():92:92 -> ˏ 16092:16092:java.util.Calendar resetAndGetWorkingCalendar():79 -> ˏ 16092:16092:java.util.Calendar resetAndGetWorkingCalendar():77 -> ˏ 16092:16092:java.util.Calendar resetAndGetWorkingCalendar():77 -> ˏ 18081:18081:int com.prolificinteractive.materialcalendarview.CalendarUtils.getDayOfWeek(java.util.Calendar):81:81 -> ˏ 18081:18081:java.util.Calendar resetAndGetWorkingCalendar():80 -> ˏ 18081:18081:java.util.Calendar resetAndGetWorkingCalendar():79 -> ˏ 18081:18081:java.util.Calendar resetAndGetWorkingCalendar():77 -> ˏ 18081:18081:java.util.Calendar resetAndGetWorkingCalendar():77 -> ˏ 18092:18092:int getFirstDayOfWeek():92:92 -> ˏ 18092:18092:java.util.Calendar resetAndGetWorkingCalendar():81 -> ˏ 18092:18092:java.util.Calendar resetAndGetWorkingCalendar():80 -> ˏ 18092:18092:java.util.Calendar resetAndGetWorkingCalendar():79 -> ˏ 18092:18092:java.util.Calendar resetAndGetWorkingCalendar():77 -> ˏ 18092:18092:java.util.Calendar resetAndGetWorkingCalendar():77 -> ˏ void buildDayViews(java.util.Collection,java.util.Calendar) -> ˋ boolean isDayEnabled(com.prolificinteractive.materialcalendarview.CalendarDay) -> ˋ 100:105:void setDayViewDecorators(java.util.List) -> ॱ 18177:18187:void invalidateDecorators():177:187 -> ॱ 18177:18187:void setDayViewDecorators(java.util.List):104 -> ॱ 20078:20083:void com.prolificinteractive.materialcalendarview.DayViewFacade.reset():78:83 -> ॱ 20078:20083:void invalidateDecorators():179 -> ॱ 20078:20083:void setDayViewDecorators(java.util.List):104 -> ॱ 21130:21130:com.prolificinteractive.materialcalendarview.CalendarDay com.prolificinteractive.materialcalendarview.DayView.getDate():130:130 -> ॱ 21130:21130:void invalidateDecorators():181 -> ॱ 21130:21130:void setDayViewDecorators(java.util.List):104 -> ॱ 23091:23100:void com.prolificinteractive.materialcalendarview.DayViewFacade.applyTo(com.prolificinteractive.materialcalendarview.DayViewFacade):91:100 -> ॱ 23091:23100:void invalidateDecorators():182 -> ॱ 23091:23100:void setDayViewDecorators(java.util.List):104 -> ॱ 25046:25051:void com.prolificinteractive.materialcalendarview.DayViewFacade.setSelectionDrawable(android.graphics.drawable.Drawable):46:51 -> ॱ 25046:25051:void com.prolificinteractive.materialcalendarview.DayViewFacade.applyTo(com.prolificinteractive.materialcalendarview.DayViewFacade):92 -> ॱ 25046:25051:void invalidateDecorators():182 -> ॱ 25046:25051:void setDayViewDecorators(java.util.List):104 -> ॱ 27032:27037:void com.prolificinteractive.materialcalendarview.DayViewFacade.setBackgroundDrawable(android.graphics.drawable.Drawable):32:37 -> ॱ 27032:27037:void com.prolificinteractive.materialcalendarview.DayViewFacade.applyTo(com.prolificinteractive.materialcalendarview.DayViewFacade):95 -> ॱ 27032:27037:void invalidateDecorators():182 -> ॱ 27032:27037:void setDayViewDecorators(java.util.List):104 -> ॱ 108:111:void setWeekDayTextAppearance(int) -> setWeekDayTextAppearance 114:117:void setDateTextAppearance(int) -> setDateTextAppearance 120:122:void setShowOtherDates(int) -> setShowOtherDates 125:129:void setSelectionEnabled(boolean) -> setSelectionEnabled 132:135:void setSelectionColor(int) -> setSelectionColor 138:141:void setWeekDayFormatter(com.prolificinteractive.materialcalendarview.format.WeekDayFormatter) -> setWeekDayFormatter 144:147:void setDayFormatter(com.prolificinteractive.materialcalendarview.format.DayFormatter) -> setDayFormatter 150:152:void setMinimumDate(com.prolificinteractive.materialcalendarview.CalendarDay) -> setMinimumDate 155:157:void setMaximumDate(com.prolificinteractive.materialcalendarview.CalendarDay) -> setMaximumDate 160:165:void setSelectedDates(java.util.Collection) -> setSelectedDates 28130:28130:com.prolificinteractive.materialcalendarview.CalendarDay com.prolificinteractive.materialcalendarview.DayView.getDate():130:130 -> setSelectedDates 28130:28130:void setSelectedDates(java.util.Collection):161 -> setSelectedDates 168:174:void updateUi() -> ˊ 30130:30130:com.prolificinteractive.materialcalendarview.CalendarDay com.prolificinteractive.materialcalendarview.DayView.getDate():130:130 -> ˊ 30130:30130:void updateUi():169 -> ˊ 30205:30206:boolean com.prolificinteractive.materialcalendarview.CalendarDay.isInRange(com.prolificinteractive.materialcalendarview.CalendarDay,com.prolificinteractive.materialcalendarview.CalendarDay):205:206 -> ˊ 30205:30206:void updateUi():171 -> ˊ 30205:30206:void updateUi():169 -> ˊ 32163:32167:void com.prolificinteractive.materialcalendarview.DayView.setupSelection(int,boolean,boolean):163:167 -> ˊ 32163:32167:void updateUi():170 -> ˊ 32163:32167:void updateUi():171 -> ˊ 32163:32167:void updateUi():169 -> ˊ 191:195:void onClick(android.view.View) -> onClick 214:248:void onMeasure(int,int) -> onMeasure int getRows() -> ॱ 261:285:void onLayout(boolean,int,int,int,int) -> onLayout 292:292:com.prolificinteractive.materialcalendarview.CalendarPagerView$LayoutParams generateLayoutParams(android.util.AttributeSet) -> ॱ 297:297:boolean shouldDelayChildPressedState() -> shouldDelayChildPressedState 305:305:boolean checkLayoutParams(android.view.ViewGroup$LayoutParams) -> checkLayoutParams 310:310:android.view.ViewGroup$LayoutParams generateLayoutParams(android.view.ViewGroup$LayoutParams) -> generateLayoutParams 316:318:void onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent) -> onInitializeAccessibilityEvent 322:324:void onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo) -> onInitializeAccessibilityNodeInfo 24:24:android.view.ViewGroup$LayoutParams generateDefaultLayoutParams() -> generateDefaultLayoutParams 32206:32206:com.prolificinteractive.materialcalendarview.CalendarPagerView$LayoutParams generateDefaultLayoutParams():206:206 -> generateDefaultLayoutParams 32206:32206:android.view.ViewGroup$LayoutParams generateDefaultLayoutParams():24 -> generateDefaultLayoutParams 24:24:android.view.ViewGroup$LayoutParams generateLayoutParams(android.util.AttributeSet) -> generateLayoutParams 29:29:void () ->