java - android studio drawable images iteration -


i put images res/drawable folder. named (s1.png, s2.png, s3png.., 2n.png).

i want loop (and process) them. like:

    (int = 1; < n; i++) {         havingfunwithpngs(r.drawable.s + inttostr('i'));     } 

ofcourse thats not how works. how it? in advance.

edit: coreproblem is, convert filename-strings corresponding ressourceid's android-studio assigns.

if want drawable id, way (passing string imagename):

int id = getresources().getidentifier(imagename, type, package);

if want see code, please @ this answer. should pass image name in string variable, think should rather use way:

string imagename = "s" + i;

because looks better, don't need convert (java automatically) , readable.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -