Added code from android project.