mercredi 29 juillet 2015

Android: how to parameterize which resource to use at runtime?

Think about a list of parameters and their respective intervals of discrete integer values:

a[1-N], b[1-M], c[1-K], d[1-J]

a, b, c, d are the variables while between square brackets there are intervals of their possible values.

At runtime if they are

a=1, b=2, c=3, d=5 

then I'd like to get the resource with

name = R.string.string_1_2_3_5

Is it possible? I wouldn't want to make a series of cascade switches for each variable to finally pick a resource. I know this could work but is there another way?





Aucun commentaire:

Enregistrer un commentaire