egslava/edittext-mask

getText() on an empty EditText returns placeholder

SammyO opened this issue · 2 comments

I have an MaskedEditText as follows:

<br.com.sapereaude.maskedEditText.MaskedEditText
	xmlns:mask="http://schemas.android.com/apk/res-auto"
	android:id="@+id/registration_citizenship_info_social_security"
	style="@style/RegistrationEditText"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:typeface="monospace"
	mask:allowed_chars="1234567890"
	mask:mask="###-##-####"
	android:hint="123456789" />

When I don't fill anything in and I call getText(), this returns me the hint (123-45-5689), instead of an empty String. getRawText() does return me an empty String if nothing was filled in, but if something was filled in, this returns me the value without formatting, which is also not what I want.

Hey SammyO,

This is not the issue of this library. This is actually EditText's "feature"(I think it's feature, because, I am having the same issue... Getting hint in getText(), instead of empty EditText. However, in stackoverflow, they keep saying that android:hint feature never gets when called getText()... Haven't tried it yet, but there is something about it...

Anyway, I cleared that line.

Sorry for my English. Haven't been practising it.

@SammyO instead of getText() use getRawText().

@PokerAsh the same to you :) "Raw" text - is the text w/o mask. So if you need a text w/o mask - give getRawText a try! :)

p.s. No worries, your English is good!