I have 2 buttons for Terms and Conditions in my project, that I need to implement in multiple activities. I created the following class:public class TermsAndConditionsView extends LinearLayout implements View.OnClickListener {    private Context context;    public TermsAndConditionsView(Context context) {        super(context);        this.context = context;    }    public TermsAndConditionsView(Context context, AttributeSet attrs) {        super(context, attrs);        this.context = context;    }    @Override    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {        super.onLayout(changed, left, top, right, bottom);        setUpLayout();    }    private void setUpLayout() {        LinearLayout container = (LinearLayout) this.getChildAt(1);        Button terms1 = (Button) container.findViewById(R.id.terms1);        Button terms2 = (Button) container.findViewById(R.id.terms2);        terms1.setOnClickListener(this);        terms2.setOnClickListener(this);    }    @Override    public void onClick(View v) {        if (v.getId() == R.id.terms1) {            String url = myUrl1;            ActivityUtil.openBrowser((Activity) context, url);        } else if (v.getId() == R.id.terms2) {            String url = myUrl2;            ActivityUtil.openBrowser((Activity) context, url);        }    }}And the terms.xml file: <?xml version=1.0 encoding=utf-8?><com.example.TermsAndConditionsViewxmlns:android=http://schemas.android.com/apk/res/androidandroid:layout_width=wrap_contentandroid:layout_height=wrap_contentandroid:layout_gravity=centerandroid:orientation=vertical><TextView    android:id=@+id/hosted_by_text_view    android:layout_width=wrap_content    android:layout_height=wrap_content    android:layout_gravity=center    android:textColor=@color/title_grey    style=@style/text1/><LinearLayout    android:layout_width=wrap_content    android:layout_height=wrap_content    android:layout_gravity=center    android:orientation=horizontal>    <Button        android:id=@+id/terms1        android:layout_width=wrap_content        android:layout_height=wrap_content        android:text=Terms 1        style=@style/Link2/>    <Button        android:id=@+id/terms2        android:layout_width=wrap_content        android:layout_height=wrap_content        android:layout_marginLeft=5dp        android:text=Terms 2        style=@style/Link2/></LinearLayout></com.example.TermsAndConditionsView>Is this a good way of reusing a group of views?My colleagues say that it's not ok to use an XML which can be modified easily because I should modify in the code also (for example changing the order of the views) and if I am not careful the app might crash and it might take some time to figure out from where the problem comes from.So, what's the best way of reusing this group of Terms and Conditions buttons?
Android Compound View Usage
java;android;xml