@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch(item.getItemId()) {
            case R.id.menu_toggle_log:
                mLogShown = !mLogShown;
                ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
                if (mLogShown) {
                    output.setDisplayedChild(1);
                } else {
                    output.setDisplayedChild(0);
                }
                supportInvalidateOptionsMenu();
                return true;
        }
        return super.onOptionsItemSelected(item);
    }
A simple launcher activity containing a summary sample description, sample log and a custom
{@link android.support.v4.app.Fragment} which can display a view.
<p>
For devices with displays with a width of 720dp or greater, the sample log is always visible,
on other devices it's visibility is controlled by an item on the Action Bar.
RecyclerView/Application/src/main/java/com/example/android/recyclerview/MainActivity.java