Refactor the code to create a standard Android library and its demo app.