jeudi 22 janvier 2015

Android uianimator: How can I get an EditText value, when a hint is set

I have an EditText field with a hint specified. For example:



<EditText
android:id="@+id/myedittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="My special hint" />


In my Android animator testcase, I have the following code:



UiObject editText = new UiObject(new UiSelector().resourceId("my.package:id/myedittext"));
System.out.println(editText.getText());


The editText.getText() statement returns the hint when the EditText is empty. Now I have a case in which I want to be sure that the EditText is empty. The hint in my case is a value which could be a legit value.


Is there a way to get around this?


Aucun commentaire:

Enregistrer un commentaire