{"action":"created","issue":{"url":"https://api.github.com/repos/alamkanak/Android-Week-View/issues/359","repository_url":"https://api.github.com/repos/alamkanak/Android-Week-View","labels_url":"https://api.github.com/repos/alamkanak/Android-Week-View/issues/359/labels{/name}","comments_url":"https://api.github.com/repos/alamkanak/Android-Week-View/issues/359/comments","events_url":"https://api.github.com/repos/alamkanak/Android-Week-View/issues/359/events","html_url":"https://github.com/alamkanak/Android-Week-View/issues/359","id":172940326,"number":359,"title":"WeekView in Fragment: You must provide a MonthChangeListener","user":{"login":"JHthe4","id":9847839,"avatar_url":"https://avatars.githubusercontent.com/u/9847839?v=3","gravatar_id":"","url":"https://api.github.com/users/JHthe4","html_url":"https://github.com/JHthe4","followers_url":"https://api.github.com/users/JHthe4/followers","following_url":"https://api.github.com/users/JHthe4/following{/other_user}","gists_url":"https://api.github.com/users/JHthe4/gists{/gist_id}","starred_url":"https://api.github.com/users/JHthe4/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JHthe4/subscriptions","organizations_url":"https://api.github.com/users/JHthe4/orgs","repos_url":"https://api.github.com/users/JHthe4/repos","events_url":"https://api.github.com/users/JHthe4/events{/privacy}","received_events_url":"https://api.github.com/users/JHthe4/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-24T12:37:31Z","updated_at":"2016-08-24T12:55:29Z","closed_at":null,"body":"Hi. I am trying to implement an AndroidWeekView in a fragment (in which it is the only view), but the app crashes with the error java.lang.IllegalStateException: You must provide a MonthChangeListener, although I have provided one in onCreateView(). The same code worked flawlessly in an activitiy's onCreate(), so I assume there to be an issue with the implementation of the fragment. See my code (shortened to the essentials for readability) below for details. Thanks for any help!\r\n\r\n```java\r\npublic class TimetableFragment extends Fragment{\r\nprivate WeekView mWeekView;\r\npublic static TimetableFragment newInstance(String param1, String param2) {\r\n        TimetableFragment fragment = new TimetableFragment();\r\n        Bundle args = new Bundle();\r\n        args.putString(ARG_PARAM1, param1);\r\n        args.putString(ARG_PARAM2, param2);\r\n        fragment.setArguments(args);\r\n        return fragment;\r\n    }\r\n@Override\r\npublic void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        if (getArguments() != null) {\r\n            mParam1 = getArguments().getString(ARG_PARAM1);\r\n            mParam2 = getArguments().getString(ARG_PARAM2);\r\n        }\r\n    }\r\n@Override\r\n    public View onCreateView(LayoutInflater inflater, ViewGroup container,\r\n                             Bundle savedInstanceState) {\r\n        // Inflate the layout for this fragment\r\n        View mView = inflater.inflate(R.layout.fragment_timetable, container, false);\r\n        mWeekView = (WeekView) mView.findViewById(R.id.weekView);\r\n        setupWeekview();\r\n        //return view\r\n        return mView;\r\n    }\r\nprivate void setupWeekview(){\r\n        if (mWeekView != null) {\r\n            //set listener for month change\r\n            mWeekView.setMonthChangeListener(new MonthLoader.MonthChangeListener() {\r\n                @Override\r\n                public List<? extends WeekViewEvent> onMonthChange(int i, int i1) {\r\n                    return new ArrayList<WeekViewEvent>();\r\n                    //TODO: Handle month change (return new list of events)\r\n                }\r\n            });\r\n\r\n            //set listener for event click\r\n            mWeekView.setOnEventClickListener(new WeekView.EventClickListener() {\r\n                @Override\r\n                public void onEventClick(WeekViewEvent event, RectF eventRect) {\r\n                    //TODO: Handle event click\r\n                }\r\n            });\r\n\r\n            //set event long press listener\r\n            mWeekView.setEventLongPressListener(new WeekView.EventLongPressListener() {\r\n                @Override\r\n                public void onEventLongPress(WeekViewEvent event, RectF eventRect) {\r\n                    //TODO: Handle event long press\r\n                }\r\n            });\r\n}}\r\n```"},"comment":{"url":"https://api.github.com/repos/alamkanak/Android-Week-View/issues/comments/242052660","html_url":"https://github.com/alamkanak/Android-Week-View/issues/359#issuecomment-242052660","issue_url":"https://api.github.com/repos/alamkanak/Android-Week-View/issues/359","id":242052660,"user":{"login":"caske33","id":896093,"avatar_url":"https://avatars.githubusercontent.com/u/896093?v=3","gravatar_id":"","url":"https://api.github.com/users/caske33","html_url":"https://github.com/caske33","followers_url":"https://api.github.com/users/caske33/followers","following_url":"https://api.github.com/users/caske33/following{/other_user}","gists_url":"https://api.github.com/users/caske33/gists{/gist_id}","starred_url":"https://api.github.com/users/caske33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caske33/subscriptions","organizations_url":"https://api.github.com/users/caske33/orgs","repos_url":"https://api.github.com/users/caske33/repos","events_url":"https://api.github.com/users/caske33/events{/privacy}","received_events_url":"https://api.github.com/users/caske33/received_events","type":"User","site_admin":false},"created_at":"2016-08-24T12:55:29Z","updated_at":"2016-08-24T12:55:29Z","body":"I don't have any experience with fragments and Android-Week-View myself. But does this comment help? https://github.com/alamkanak/Android-Week-View/issues/300#issuecomment-229476623"}}
{"actor":{"display_login":"caske33"}}