Is it possible to set text in EditText
only for a certain buildtype?
I want the EditText
in the app I'm developing to be prefilled when running the debug buildtype.
The only way I see this right now is by checking programmatically if the current the current buildtype is "debug" and call setText()
.
I was hoping to be able to do this in a cleaner way. Perhaps something like the tools
namespace in XML layouts.
Any suggestions?
Eventually I went with my own way of keeping it clean. I've had a look at Aspect Oriented Programming and made an Aspect with AspectJ.
I've added this aspect to my
src/debug/java
folder so this aspect is only applied when a debug build is run. There's no code whatsoever in my main source, so this will never be shipped and the code base remains clean.I've written an article about this here: https://medium.com/@dumazy/prefill-forms-on-android-with-aspectj-97fe9b3b48ab