Skip to content

Android library for a spinner view class to select date and time formats

License

Notifications You must be signed in to change notification settings

j4velin/dateFormatSpinner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dateFormatSpinner

Usage

Add a spinner for date formats

        <de.j4velin.dateFormatSpinner.DateFormatSpinner
        xmlns:spinner="http://schemas.android.com/apk/res-auto"
            android:id="@+id/date"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            spinner:defaultFormats="date"/>

or for time formats

        <de.j4velin.dateFormatSpinner.DateFormatSpinner
        xmlns:spinner="http://schemas.android.com/apk/res-auto"
            android:id="@+id/time"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            spinner:defaultFormats="time"/>

to your layout xml file. To use the selected format in your code, call the getValue() method on the Spinner:

        String pattern = ((DateFormatSpinner) getView().findViewById(R.id.date)).getValue();
        String formatedDate = new SimpleDateFormat(pattern).format(System.currentTimeMillis());

About

Android library for a spinner view class to select date and time formats

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages