Using Emacs in Android Development
I’ve got a folder full of country flags which I have renamed using scripts so the names correspond to currency symbols. I want an integer array with references to the flags as android resources. This can be automated using emacs.
I get a list of the file names into a buffer using find, which I then open with emacs.
% find src/ -name flag* > data/sym-flags.lst
They are already sorted, but just to make sure I use M-x sort-lines
.
I need to replace the path with R.drawable.
, so I use M-% replace string
. There is a bulk replace command in the docs somewhere, but it
is easier to press ‘!’ than look it up.
Same again, to get rid of the .png
and replace with a comma.
I want the list in a neat block, so M-q
to fill the notional
paragraph.
It’s then trivial to copy the list to your code and wrap it with an array declaration.
See Also
- Using Emacs as an IDE
- Flutter app bar search widget
- Android Navigation Menu
- Update App Widget
- Create a Word Grid