— 28th January 2009
This was one of a series of posts I wrote on a short lived android dev blog I had during a period where I did a tiny bit of android app development.
OK here's one which seems fairly big. Most of the time you refer to your resources (images, xml layouts etc) using this handy class called R. This is great in Eclipse (another thing I'm new to) because this R class is created automatically from files you drop in folders so Eclipse's auto-complete function can be used to pick up the resources (via this class) without you needing to look in your folder and check filenames etc. Coming from text-editor style web development this seems very nice. However when I actually want to pick up one of those images and use it in an Activity (e.g. in an ImageView) the R class doesn't get me there because all it returns is the ID of the resource. So what I have to use is another method.
getResources().getDrawable(R.drawable.image);I know I'm going to be coming back to this one time and again.