Click here to Skip to main content
15,910,277 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to open my context menu via menu options but I do not know what to declare in the view area, anyhelp would be appreciated.


Java
public boolean onOptionsItemSelected(MenuItem item) {
        Intent serverIntent = null;
        switch (item.getItemId()) {
        
        case R.id.directioncontrolmenu:
            // OpenChange Direction Pad menu
//What should I declare view here as? So I could call the context menu.
            openContextMenu();

            return true;
        }
        return false;
    }


Java
public void onCreateContextMenu(ContextMenu menu, View v,
			ContextMenu.ContextMenuInfo menuInfo) {
		if (v == findViewById(R.id.directioncontrolmenu)) {
			menu.add(100,101,1, "Dpad only");
			menu.add(100,102,3, "Up and Down Button With Gyroscope");
			

		}
	}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900