refactoring of android code