modify the sample code from the android sdk