0
음악 파일 조작에 대한 다양한 유형의 컨텍스트 메뉴를 만들고 있습니다. 그러나 컨텍스트 메뉴 항목을 선택할 수 없습니다. 아래 코드에서 test4contextmenu
은 TextView
레이아웃을 포함하는 클래스입니다.ContextMenu 항목 선택?
public boolean onContextItemSelected(MenuItem item) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)item.getMenuInfo();
int menuItemIndex = item.getItemId();
String menuItemName = menuItems[menuItemIndex];
String songName = songs.get(info.position);
text = (TextView)findViewById(R.id.text1);
text.setText(String.format("Selected %s for item %s", menuItemName, songName));
startActivity(new Intent(this,test4contextmenu.class));
return true;
}