I have a RelativeLayout with a button inside it. Once the user clicks on that button, I would like to change the background of the parent view (RelativeLayout). I know I can do
Try View.getParent():
Button yourBtn = (Button) findViewById(R.id.your_btn); RelativeLayout yourRelLay = (RelativeLayout) yourBtn.getParent();