I have a case where the application remembers the last text that was
entered into it. I want to be able to replace that text with something
else in my test but I don't see any such method in the Instrumentation
class!

What I do is something like this. See the comment for an instruction I
need to have that I cannot find. Thanks!

                monitor = instrumentation.addMonitor(MyActivity.class.getName(),
null, false);

                TouchUtils.clickView(this, currentView);

                currentActivity =
getInstrumentation().waitForMonitorWithTimeout(monitor, 5);

                assertEquals("ADD something meaningful here to verify we are at 
the
right place.", true, true);

                currentView =
currentActivity.findViewById(com.mycompany.android.R.id.username);
                assertTrue(currentView instanceof EditText);

//NEED TO CLEAR THE FIELD HERE AS WHAT I SEND DOES NOT SEEM TO
REPLACE, BUT ADD

                instrumentation.sendStringSync("SOME NEW TEXT");
...

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to