Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;

import android.widget.TimePicker;

public class Main {
    public static void initTimePicker(TimePicker timePicker, long date) {
        timePicker.setCurrentMinute(getMinute(date));
        timePicker.setCurrentHour(getHourOfDay(date));
    }

    public static int getMinute(long date) {
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(date);
        return c.get(Calendar.MINUTE);
    }

    public static int getHourOfDay(long date) {
        Calendar c = Calendar.getInstance();
        c.setTimeInMillis(date);
        return c.get(Calendar.HOUR_OF_DAY);
    }
}