selfstarter

Using Android getIdentifier 본문

App/Android

Using Android getIdentifier

selfstarter 2020. 3. 12. 16:49

name : id name
defType : search type
defPackage : current package name

for (int i = 1; i <= 5; ++i) {  
    int id = getResources().getIdentifier("bt0" + i, "id", getPackageName());  
    ToggleButton btn = findViewById(id);  
}
Comments