0

I found a lot of question about this problem, but I can't fix it. I am creating custom contextual action bars (CAB) within WebView i followed this Tutorial

My problem is CAB working fine in setOnLongClickListener but i cant able to select the text.

I referred these links:

Link 1, Link 2

Edit :

    mywebview.setOnLongClickListener(new OnLongClickListener() {

        @Override
        public boolean onLongClick(View v) {
             mActionMode = MainActivity.this.startActionMode(new ActionBarCallBack());
             return true;
        }
    });

Implement the ActionMode.Callback interface:

    class ActionBarCallBack implements ActionMode.Callback {

    @Override
    public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public boolean onCreateActionMode(ActionMode mode, Menu menu) {
        // TODO Auto-generated method stub
        mode.getMenuInflater().inflate(R.menu.contextual_menu, menu);
        return true;
    }

    @Override
    public void onDestroyActionMode(ActionMode mode) {
        // TODO Auto-generated method stub

    }

    @Override
    public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
        // TODO Auto-generated method stub
        return false;
    }

} 

I Tried like this :

     @Override
     public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
     {
           super.onCreateContextMenu(menu, v, menuInfo);
           mActionMode = Contents.this.startActionMode(new ActionBarCallBack());
     }

Help me where i am wrong. Thank in advanced

Community
  • 1
  • 1
prabhakaran
  • 668
  • 2
  • 10
  • 33

0 Answers0