Code example for MenuItem

Methods: getItemIdgetMenuInfo

0
	menu.add(0, MENU_OPEN_AUTHOR_PROFILE, 0, R.string.open_author_profile);
    } 
 
    @Override 
    public boolean onContextItemSelected(MenuItem item) {
	AdapterContextMenuInfo adapterContextMenuInfo = (AdapterContextMenuInfo) item.getMenuInfo();
	CommentsData commentsData = (CommentsData) getListAdapter().getItem(adapterContextMenuInfo.position);
 
	switch (item.getItemId()) {
	    case MENU_OPEN_COMMENT_IN_BROWSER:
		startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(commentsData.getUrl())));
		break; 
	    case MENU_OPEN_AUTHOR_PROFILE:
		startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(commentsData.getAuthorUrl())));
		break; 
	} 
	 
	return super.onContextItemSelected(item);
    } 
 
    @Override 
    public Loader<ArrayList<CommentsData>> onCreateLoader(int id, Bundle args) {
	QaCommentsLoader loader = new QaCommentsLoader(getSherlockActivity(), url);