Word Count in DroidEdit Pro
I'm a writer, and it is often important for me to be able to write whenever I can fit in time, even if I'm not at my computer. For writing away from my desk, I often use my phone or tablet, and the app I prefer is DroidEdit Pro. A key missing feature in that editor is a word count for the current document. I wanted to find a more streamlined way to get the word count than copying and pasting into a separate app.
This fix involves using Java in Tasker (a fantastic app for doing all kinds of cool things on your mobile devices). I created a task with a few actions that basically get the word count for whatever is in the clipboard and then briefly display that on the screen. This means I still have to do a select-all and copy, but after that I just tap a widget icon on my home screen and I get the count. It's not perfect, but it's definitely better. Ideally the editor itself will eventually include a word count feature, but for now I'm reasonably set.
The task uses an IF/END-IF structure to skip processing if the clipboard is empty. Otherwise, it creates a Java StringTokenizer object, calls the countTokens method and assigns the result to a Tasker variable, and then "flashes" that variable on the screen.
The task XML file is attached here, if you'd like to use it. (Updated 27 FEB 2017 to include an ELSE condition in case the clipboard is empty.) It's not large or difficult to create from scratch, but it's even easier to import it! You will probably need to rename the file, since Drupal apparently -- "for security reasons" (??) -- inserted an underscore in it after "tsk" -- simply remove the underscore to make the file visible to the Tasker import process.