Example usage for android.support.v4.view MenuItem getIntent

List of usage examples for android.support.v4.view MenuItem getIntent

Introduction

In this page you can find the example usage for android.support.v4.view MenuItem getIntent.

Prototype

public Intent getIntent();

Source Link

Document

Return the Intent associated with this item.

Usage

From source file:com.todoroo.astrid.activity.FilterListFragment.java

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    // handle my own menus
    switch (item.getItemId()) {
    case CONTEXT_MENU_SHORTCUT: {
        AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
        final Intent shortcutIntent = item.getIntent();
        FilterListItem filter = ((FilterAdapter.ViewHolder) info.targetView.getTag()).item;
        if (filter instanceof Filter)
            showCreateShortcutDialog(getActivity(), shortcutIntent, (Filter) filter);

        return true;
    }// w w  w.  j a v a  2 s .  co  m
    case CONTEXT_MENU_INTENT: {
        Intent intent = item.getIntent();
        startActivityForResult(intent, REQUEST_CUSTOM_INTENT);
        return true;
    }
    default: {
        Fragment tasklist = getSupportFragmentManager()
                .findFragmentByTag(TaskListFragment.TAG_TASKLIST_FRAGMENT);
        if (tasklist != null && tasklist.isInLayout())
            return tasklist.onOptionsItemSelected(item);
    }
    }
    return false;
}