ANDROID: refactor shared code