Eliminating getLayoutResId() in favor of setContentView(R.layout.activity_masterdetail);

Calling setContentView(R.layout.activity_masterdetail) in SingleFragmentActivity will produce the same result as calling protected int getLayoutResId() { return R.layout.activity_masterdetail; } in CrimeListActivity. Isn’t this redundant since the device will configure our layout depending on the screen dimension?

The class SingleFragmentActivity will be the super class of CrimeListActivity as well as other classes such as DatePickerActivity in this project.

The following methods in SingleFragmentActivity will make it a common one for all its child classes.

    @LayoutRes
    protected int getLayoutResId() {
        return R.layout.activity_fragment;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutResId());

        // ......
    }