Is possible in Android to findView by String Id?
I add some rows in table programmatically and in next iteration need to remove some of them and I have List id ( "tblRow_1", "tblRow_3" ..}). Can I retrieve by ids from the list?
Use getResources().getIdentifier()
to retrieve the actual integer resource ID.
example
int resID = getResources().getIdentifier(stringVar, "id", "com.sample.project");
view = findViewById(resID);
You can use Resources.getIdentifier()
for this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With