Since I\'m still just learning Android (and it appears Amazon says it\'ll be 2 months till I get the Hello, Android book) I\'m still playing around with doing simple things.
It looks like you might be adding the view to the root of the layout xml instead of the RelativeLayout.
You could try:
RelativeLayout layout = (RelativeLayout)findViewById(R.id.my_layout); layout.addView(addIcon());