AppleGrew
AppleGrew

Reputation: 9570

Why android returns Editable instead of String?

Even after setting EditText type to date or number etc., I need to convert the output of getText() to String first then to respective Date or Integer.

So, Editable does not seem any better than mere String, so why doesn't Android just return the String?

Upvotes: 1

Views: 155

Answers (1)

krsteeve
krsteeve

Reputation: 1804

According to the documentation String is immutable. Editable however allows its markup and content to be changed.

The reason EditText returns an Editable is likely for your ease - so you can edit the text, and set it again.

Upvotes: 1

Related Questions