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.
you are creating new relative layout inside function call. So every time new relative layout created and it added in the view when click button . Use common relative layout.
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());