简体   繁体   中英

Android Week View Issue

I'm using this library : https://github.com/alamkanak/Android-Week-View

I'm new to Android, and I'm needing some help to solve this issue, I can't understand why I'm getting this error:

"cannot resolve symbol mWeekView"

If anyone have the answer, it would be appreciated.

Here is a screenshot :

屏幕

EDIT : even with the implements, still getting this error

mWeekView is object of WeekView in your class. Add this->

WeekView mWeekView;

before onCreate() method.

You need the mWeekView field in your class. Add this line to the start of the class (the next line after the public class ... ):

private WeekView mWeekView;

Just declare you view as a WeekView. Also add the following so it will load some default dummy event so you can at least try out the view (Put this in your oncreate()):

    WeekView mWeekView = (WeekView) findViewById(R.id.weekView);

    mWeekView.setOnEventClickListener(new WeekView.EventClickListener() {
        @Override
        public void onEventClick(WeekViewEvent event, RectF eventRect) {

        }
    });

    mWeekView.setMonthChangeListener(new MonthLoader.MonthChangeListener() {
        @Override
        public List<WeekViewEvent> onMonthChange(int newYear, int newMonth) {
            List<WeekViewEvent> events = new ArrayList<WeekViewEvent>();

            Calendar calendar = Calendar.getInstance();
            Calendar calendar1 = Calendar.getInstance();
            calendar1.add(Calendar.HOUR, 1);
            WeekViewEvent someEvent = new WeekViewEvent(1,"someEvent",calendar,calendar1);
            events.add(someEvent);
            return events;
        }
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM