I want the user to select a wallpaper and I'll set it as the android wallpaper. I'm currently using this line:
myWallpaperManager.setResource(R.drawable.a1);
Problem is it's not dynamic and I want to change the chosen image to R.drawable.a2
,R.drawable.a3
,R.drawable.a4
, etc based on the number I got.
So if I have int chosenPicNum=3 I want to create the string "R.drawable.a
"+3 and then call myWallpaperManager.setResource(R.drawable.a3);
But I can't do it. The error is eclipse reads it as a string and not a resource. Currently here's the closest I've gotten:
String imageResource="R.drawable.a"+chosenPicNum) ;
So imageResource in this case is String type "R.drawable.a3
" but I want it to be R.drawable.a3.
Thank you for your help!!
Dvir, ambitious 20 year old :)