You just need a link to the activity and the call:
RelativeLayout relativeLayout = (RelativeLayout)activity.getLayoutInflater().inflate(R.layout.your_layout, null);
Then you can capture two views using their identifiers
relativeLayout.findViewById(R.id.anId);
source
share