Q:

Can we give registerforcontextmenu and onclicklistener for a same Textview

there is a small issue I am using OnClick for for moving text up and dowm and registerforcontextmenu for showing menu list...Problem here is if I am using registerforcontextmenu for textview1 then onclick is not performing on the Textview1...Why I dont know....I need your suggestion ..thank you –

A:

I trigger the context menu to open in the onLongClickListener. Then it's possible to use onClickListener and onLongClickListener at the same time.
TV.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        // do something
    }
});

TV.setOnLongClickListener(new View.OnLongClickListener() {
    @Override
    public boolean onLongClick(View v) {
        registerForContextMenu(v);
        openContextMenu(v);
        unregisterForContextMenu(v);
        return true;
    }
});

