You cannot dynamically create new identifiers. Even if you Rwere able to do this, you will not be able to access it using R.id.a_custom_id. Java is not a dynamic language and cannot add fields at run time.
However, there is a solution for compilation. In res/values/ids.xmladd:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<item type="id" name="a_custom_id"/>
</resources>
R.id.a_custom_id "@id/a_custom_id" xmls. , id ( , ).