'Find all view names on page

Is there a way to list all the display fields (view names?) with their ids? This

int id = getResources().getIdentifier(name, "id", context.getPackageName());
View view = findViewById(id);

is fine to return a single id from a name, but what I'd like is an array or map with ids and names. My reasoning is that getIdentifier is discouraged (inefficient), and if there is a quicker way I'd prefer to use it. I have to match a longish list of variable name/value pairs (20-30) from a csv with the matching field name (if it exists) to display the value.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source