Standardize edtitext type date

Asked

Viewed 49 times

1

I’d like to know how I change the format of EditText date-like

android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="date"        
        android:ems="10"
        android:id="@+id/dtfinal"
        android:layout_below="@+id/textView6"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true"
        android:text="@string/lbldtfinal"/>

With this format, when the user type the date, the format that appears on the screen and saved to my program is: 14042016. I would like that, when the user is going to type the date, automatically is being added (-), that is, when he type the day 14, appears on the screen for him 14- and then the result of what he typed would be 14-04-2016.
I know you have to change something in xml, and I know there’s a calendar and the datapicker, but I would like something simpler like this example above. But examples with datapicker would be good for future changes, since explained how I should use it.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.