Is it possible to find a view by its name rather than its id.
findViewById(R.id.someView);
but I would like to do something like this:
Yes, we can find any static resources by name too.
int id = getResources().getIdentifier(name, "id", context.getPackageName()); View view; if(id != 0) { view = findViewById(id); }
getResources().identifier will return 0 always if resource not found or name doesn't match.