Code Monkey home page Code Monkey logo

Comments (6)

nomanr avatar nomanr commented on June 25, 2024

Could you please share the code where using the calendar. One know issue could me inside fragment where you are using getActivity().getSupportFragment() , replace it will getChildFragmentManager() .

And it is not Calendars issue, Calendar contains fragment and you are using a fragment inside a fragment.

from weekcalendar.

SaraAshourHelmy avatar SaraAshourHelmy commented on June 25, 2024

i am using tabhost and this tabs contains fragments when press to fragment that contain calendar
execute this method firt 👍

private void SetupCalendar() {

    selected_date = Calendar.getInstance();
    updated_date = Calendar.getInstance();
    txtDate_format = new SimpleDateFormat("EEEE MMMM dd, yyyy");
    date_format = new SimpleDateFormat("yyyy-MM-dd");

    // set current date
    // Note calendar start month index from 0 so month number will be -1
    Calendar c = Calendar.getInstance();
    selected_year = c.get(Calendar.YEAR);
    selected_month = c.get(Calendar.MONTH);
    selected_day = c.get(Calendar.DAY_OF_MONTH);

    // set current date in Textview
    String folderName = txtDate_format.format(c.getTime());
    tv_selected_date.setText(folderName);
    tv_selected_date.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ShowCalendar();
        }
    });

    // when click on swipe calendar
    weekCalendar.setOnDateClickListener(new OnDateClickListener() {
        @Override
        public void onDateClick(DateTime dateTime) {

            selected_date.set(Calendar.YEAR, dateTime.getYear());
            selected_date.set(Calendar.MONTH, dateTime.getMonthOfYear());
            selected_date.set(Calendar.DAY_OF_MONTH, dateTime.getDayOfMonth());

            selected_year = dateTime.getYear();
            selected_month = dateTime.getMonthOfYear() - 1;
            selected_day = dateTime.getDayOfMonth();

            try {
                Date folderName1 = date_format.parse(dateTime.toString());
                Log.e("selected_date", selected_date + "");

                tv_selected_date.setText(txtDate_format.format(folderName1));
            } catch (Exception e) {
                Log.e("date error", "" + e);
            }
        }

    });


}

from weekcalendar.

alexarraiza avatar alexarraiza commented on June 25, 2024

I get the same problem whenever I put more than one WeekCalendar on a fragment, e.g., I have an adapter where some items contain two WeekCalendars, but only the first one of the whole screen loads the days.

Is this a known issue or is there a limit of how many calendars can you load on the same fragment/activity?

Thank you, if I find anything else that relates to this problem I'll update you!

Edit: When having multiple fragments, each with a calendar, when the one that is showing the days is garbage collected, the next one that loads will be the one that show days.

from weekcalendar.

samarti avatar samarti commented on June 25, 2024

+1, same here!

from weekcalendar.

erichlotto avatar erichlotto commented on June 25, 2024

+1 same here!

from weekcalendar.

HugoMartins avatar HugoMartins commented on June 25, 2024

+1 same here!

from weekcalendar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.