refine android code according to the latest api