Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UiAutomator Android - setText method is not working.!

Now, I am trying for using UIAutomator. We create an application. When testing it, setText method of UIAutomator is not working. When click EditText, key board is appeared. And then set text to this object, but it is not worked.

Here my code for EditText,

<EditText android:id="@+id/category_editText"
             style="@style/Brown.textBox"
             android:layout_width="match_parent"
             android:layout_height="33dp"
             android:contentDescription="@string/category_editText"
             android:ems="10"
             android:gravity="center_vertical"
             android:hint="@string/category_entry"
             android:lines="1"
             android:maxLength="50"
             android:paddingLeft="3dp"
             android:paddingRight="3dp"
             android:scrollHorizontally="true"
             android:singleLine="true" />

Anyone, can help me ? Thanks.

like image 485
R.Katnaan Avatar asked Oct 17 '25 20:10

R.Katnaan


1 Answers

I encountered the same issue. I used legacySetText instead of setText and it worked

like image 172
Blackbelt Avatar answered Oct 20 '25 11:10

Blackbelt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!