content: package com.zdvdev.sample;
  
  import android.os.Bundle;
  import android.support.design.widget.Snackbar;
  import android.support.v7.app.AppCompatActivity;
  import android.support.v7.widget.Toolbar;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.View.OnClickListener;
  
  public class MainActivity extends AppCompatActivity {
  
      View rootView;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          toolbar.setTitle(getString(R.string.app_name));
          setSupportActionBar(toolbar);
          rootView = findViewById(R.id.activity_main);
  
          findViewById(R.id.checkView1).setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                  Snackbar.make(rootView, "Button clicked", Snackbar.LENGTH_SHORT).show();
              }
          });
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          getMenuInflater().inflate(R.menu.checkview_menu, menu);
          return super.onCreateOptionsMenu(menu);
      }
  
      @Override
      public boolean onPrepareOptionsMenu(Menu menu) {
          return super.onPrepareOptionsMenu(menu);
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          if (item.getItemId() == R.id.menu_checkview) {
              Snackbar.make(rootView, "Menu item clicked", Snackbar.LENGTH_SHORT).show();
          }
          return super.onOptionsItemSelected(item);
      }
  }
  