@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { if (v.getId() == listView.getId()) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; menu.setHeaderTitle("Menu for entry" + info.position); menu.add(Menu.NONE, 0, 0, "View DocumentsList"); } super.onCreateContextMenu(menu, v, menuInfo); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.nxcp); waitingMessage = (TextView) findViewById(R.id.waitingMessage); refreshBtn = findViewById(R.id.refreshBtn); refreshBtn.setOnClickListener(this); listView = (ListView) findViewById(R.id.myList); registerForContextMenu(listView); listView.setOnItemClickListener(this); }