title: contextMenu dosent work and crash when played
body: <p>My code crashes in the line  <code>registerForContextMenu(lv);</code></p>
  
  <p>Can you see the problem? i am stuck for hours.</p>
  
  <p>i am trying to connect a listview
  i know its something small but i cant find it
  please need some help
  the code:</p>
  
  <pre><code> protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_boss);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
          datasource = new TableInfoDataSource(this);
          datasource.open();
          userPreferences = null;
          userPreferences = datasource.getAllPublications();
          lv = (ListView) findViewById(android.R.id.list);
          registerForContextMenu(lv); // for context menu!
          adapter = new CustomAdapter(Boss.this, R.layout.simple_list_item_2, userPreferences);
          lv.setAdapter(adapter);
          datasource.close();
          FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
          fab.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
  //                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
  //                        .setAction("Action", null).show();
                  Intent intent_employee = new Intent(Boss.this, BossAddJob.class);
                  startActivity(intent_employee);
              }
          });
  
  
      }
  
      class CustomAdapter extends ArrayAdapter&lt;TableInfo&gt; {
  
          Context context;
          int layoutResourceId;
          ArrayList&lt;TableInfo&gt; data = null;
          private LayoutInflater mInflater;
  
  
          public CustomAdapter(Context context, int layoutResourceId, ArrayList&lt;TableInfo&gt; data) {
              super(context, layoutResourceId, data);
              this.layoutResourceId = layoutResourceId;
              this.context = context;
              this.data = data;
              this.mInflater = LayoutInflater.from(context);
          }
  
   @Override
      public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
          super.onCreateContextMenu(menu, v, menuInfo);
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.context_menu, menu);
      }
  
      @Override
      public boolean onContextItemSelected(MenuItem item) {
          //final SharedPreferences.Editor editor = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE).edit();
          AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
  
          switch (item.getItemId()) {
              case R.id.ViewInContextMenu:
  
                  return true;
  
              case R.id.DeleteInContextMenu:
  
                  return true;
              default:
                  return super.onContextItemSelected(item);
          }
  </code></pre>