Get the number of rows for the provided month via MonthDisplayHelper - Android java.util

Android examples for java.util:Month

Description

Get the number of rows for the provided month via MonthDisplayHelper

Demo Code


//package com.java2s;

import android.util.MonthDisplayHelper;

import java.util.Calendar;

public class Main {
    /**/*ww w.  j a  v a 2 s. c  om*/
     * Get the number of rows for the provided month
     * @param year year
     * @param month month
     * @return number of rows
     */
    public static int getNumOfRowsForTheMonth(int year, int month,
            int startDayOfTheWeek) {
        Calendar cal = Calendar.getInstance();
        cal.set(year, month, 1);
        MonthDisplayHelper displayHelper = new MonthDisplayHelper(year,
                month, startDayOfTheWeek);
        return displayHelper.getRowOf(cal
                .getActualMaximum(Calendar.DAY_OF_MONTH)) + 1;
    }
}

Related Tutorials