How to get id (string) of view using view.getId() inside Android Espresso custom matcher?

Issue

I need to get id (string) of view inside custom Espresso matcher. I need to write into log something like with id: com.domain:id/et_name.

I have tried to use: Resources.getSystem().getResourceName(textView.getId());, but it returns null.

What is way to get id inside espresso matcher ?

Solution

Here is a way to get view id (string): textView.getResources().getResourceName(textView.getId()); , but looks like espresso not allowing to write a log -:(

Answered By – IgorOK

Leave a Comment