How do I programatically change tools?


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() {
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.


Try the following.

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

See in the Tools project for example.