How do I programatically change tools?

Question:

What I am trying to achieve is utilising your Ink tool (or any other tool) from my own button call.

My code to call is below:

freeHand.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FreeText freeTextTool = (FreeText) (mToolManager.createTool(ToolManager.e_text_create,null)); } });

I however, haven’t managed to get any further than this.

Answer:

Try the following.
`

FreeTextCreate freeTextTool = (FreeTextCreate) ((ToolManager) mPDFView.getToolManager()).createTool(ToolManager.e_text_create, this);
((ToolManager) mPDFView.getToolManager()).setTool(freeTextTool);
`

See Pan.java in the Tools project for example.