FileDocCategorySizeDatePackage
DateWidgets2.javaAPI DocGoogle Android v1.5 Example1995Sun Nov 11 13:01:04 GMT 2007com.google.android.samples.view

DateWidgets2

public class DateWidgets2 extends android.app.Activity

Fields Summary
private android.widget.TextView
mTimeDisplay
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);

        setContentView(R.layout.date_widgets_example_2);

        TimePicker timePicker = (TimePicker) findViewById(R.id.timePicker);
        timePicker.setCurrentHour(12);
        timePicker.setCurrentMinute(15);

        mTimeDisplay = (TextView) findViewById(R.id.dateDisplay);

        updateDisplay(12, 15);

        timePicker.setOnTimeChangedListener(new TimePicker.OnTimeChangedListener() {

            public void timeChanged(TimePicker view, int hourOfDay, int minute) {
                updateDisplay(hourOfDay, minute);
            }
        });
    
private static java.lang.Stringpad(int c)

        if (c >= 10)
            return String.valueOf(c);
        else
            return "0" + String.valueOf(c);
    
private voidupdateDisplay(int hourOfDay, int minute)

        mTimeDisplay.setText(
                    new StringBuilder()
                    .append(pad(hourOfDay)).append(":")
                    .append(pad(minute)));